| (reify ItemListener
| (itemStateChanged
| [this e]
| (f (selected? e))))
The fact that Protocols method name, arg list and method body are all
indented to nearly the same level makes multiple methods and even
multiple protocols all kind of mush together visually. Is there any
way to hack or customize clojure-mode to get something like this:
| (reify ItemListener
| (itemStateChanged
| [this e]
| (f (selected? e))))
or (even nicer)
| (reify ItemListener
| (itemStateChanged [this e]
| (f (selected? e))))
I also have my troubles with letfn such that I find myself just always
using let as a result. (i.e. my editor's ugly indentation defaults
drive my choice of construct -- how demented is that?)
Any tips?
// Ben
Even using Phil's clojure-mode I find myself often editing the source
code of clojure-mode to add custom indentation or fontification for my
own macros or for forms I feel have been missed. Perhaps some of the
lists of function/marco-names in clojure-mode could be tucked behind
user-configurable variables to allow personalization without editing of
the source file.
When writing emacs-lisp it is possible to include indentation
information into a definition e.g.
(defmacro do-something-to-something (thing &rest stuff-to-do)
(declare (indent 1))
...)
the `(declare (indent 1))' ensures that it will be indented as follows
(do-something-to-something thing
(stuff-to-do))
perhaps something similar could be done in Clojure using meta
information, although that may be asking for far too much Clojure/e-lisp
interaction?
I'd have to think this issue has been addressed by the CL community.
Cheers -- Eric
(defun clojure-new-indent (&optional func level)
"Set the indentation level of FUNC to LEVEL."
(interactive)
(let ((func (or func
(read-from-minibuffer "function name: "
(condition-case nil
(which-function) (error nil)))))
(level (or level (read-from-minibuffer "indent (number): " "1")))))
(put (if (stringp func) (intern func) func)
'clojure-indent-function
(if (stringp level) (string-to-number level) level)))
e.g. (clojure-new-indent 'while-let 1) will result in
(while-let [something stuff]
(body))
rather than
(while-let [something stuff]
(body))
Cheers -- Eric
I'll give that a try. Thanks!
// ben