|
158 | 158 | :block (set block)}))
|
159 | 159 |
|
160 | 160 | (def lispwords
|
161 |
| - "Specially indented symbols in clojure.core and clojure.test. Please read |
162 |
| - the commit message tagged `lispwords-guidelines` when adding new words to |
163 |
| - this list." |
| 161 | + "Specially indented symbols in clojure.core and clojure.test. The following |
| 162 | + commit message (tag `lispwords-guidelines`) outlines a convention: |
| 163 | +
|
| 164 | + commit c2920f43191ae48084cea2c641a42ca8d34381f5 |
| 165 | + |
| 166 | + Date: Sat Jan 26 06:53:14 2013 -0600 |
| 167 | +
|
| 168 | + Update lispwords |
| 169 | +
|
| 170 | + Besides expanding the definitions into an easily maintainable style, we |
| 171 | + update the set of words for Clojure 1.5 using a simple rule: |
| 172 | +
|
| 173 | + A function should only be indented specially if its first argument |
| 174 | + is special. |
| 175 | +
|
| 176 | + This generally includes: |
| 177 | +
|
| 178 | + * Definitions |
| 179 | + * Binding forms |
| 180 | + * Constructs that branch from a predicate |
| 181 | +
|
| 182 | + What it does not include are functions/macros that accept a flat list of |
| 183 | + arguments (arglist: [& body]). Omissions include: |
| 184 | +
|
| 185 | + clojure.core/dosync [& exprs] |
| 186 | + clojure.core/future [& body] |
| 187 | + clojure.core/gen-class [& options] |
| 188 | + clojure.core/gen-interface [& options] |
| 189 | + clojure.core/with-out-str [& body] |
| 190 | +
|
| 191 | + Also added some symbols from clojure.test, since this namespace is |
| 192 | + present in many projects. |
| 193 | +
|
| 194 | + Interestingly, clojure-mode.el includes \"assoc\" and \"struct-map\" in the |
| 195 | + special indent list, which makes a good deal of sense: |
| 196 | +
|
| 197 | + (assoc my-map |
| 198 | + :foo \"foo\" |
| 199 | + :bar \"bar\") |
| 200 | +
|
| 201 | + If we were to include this in lispwords, the following functions/macros |
| 202 | + should also be considered since they also take optional key value pairs |
| 203 | + at the end of the arglist: |
| 204 | +
|
| 205 | + clojure.core/agent [state & options] |
| 206 | + clojure.core/assoc … [map key val & kvs] |
| 207 | + clojure.core/assoc! … [coll key val & kvs] |
| 208 | + clojure.core/atom … [x & options] |
| 209 | + clojure.core/ref [x] [x & options] |
| 210 | + clojure.core/refer [ns-sym & filters] |
| 211 | + clojure.core/restart-agent [a new-state & options] |
| 212 | + clojure.core/slurp [f & opts] |
| 213 | + clojure.core/sorted-map-by [comparator & keyvals] |
| 214 | + clojure.core/spit [f content & options] |
| 215 | + clojure.core/struct-map [s & inits]" |
164 | 216 | (set/union
|
165 | 217 | ;; Definitions
|
166 | 218 | '#{bound-fn def definline definterface defmacro defmethod defmulti defn
|
|
0 commit comments