Re: Using metadata to specify how calls to a macro should be indented

2015-09-23 Thread Artur Malabarba
2015-09-23 10:32 GMT+01:00 Phillip Lord : > Specifically wrt to CIDER, the easier solution is the cache the metadata > map each time it is used. I suspect that CIDER would need this for > performance -- I mean indentation requiring ongoing evaluation in > Clojure is

Re: Using metadata to specify how calls to a macro should be indented

2015-09-23 Thread Phillip Lord
Artur Malabarba writes: >> > Yes, that's what the current (but unmerged) implementation does. :) > >> If this cache were persisted between Emacs sessions then the problem >> largely goes away. >> > Yes, that's very plausible to do. I am happy to do the implementation

Re: Using metadata to specify how calls to a macro should be indented

2015-09-23 Thread Artur Malabarba
Great! ☺ Bring it up on the cider gitter room. On 23 Sep 2015 3:55 pm, "Phillip Lord" wrote: > Artur Malabarba writes: > >> > > Yes, that's what the current (but unmerged) implementation does. :) > > > >> If this cache were persisted between

Re: Using metadata to specify how calls to a macro should be indented

2015-09-23 Thread Phillip Lord
Artur Malabarba writes: > You're right about indentation depending on the code being evaluated, but > that's still better than nothing. ☺ > > People who do a significant amount of coding without a live session can > still manually configure indentation like they

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Fluid Dynamics
On Tuesday, September 22, 2015 at 6:31:34 AM UTC-4, Phillip Lord wrote: > > ... The interesting question then is what > percentage of the time do Clojure developers work *without* a repl > active. > Uhhh, zero? :) -- You received this message because you are subscribed to the Google Groups

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Gary Trakhman
Sometimes more than 0% when I'm doing something small in clojurescript, can't be bothered with the setup, and browser refresh is good enough :-). On Tue, Sep 22, 2015 at 4:02 PM Fluid Dynamics wrote: > On Tuesday, September 22, 2015 at 6:31:34 AM UTC-4, Phillip Lord wrote: >>

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Artur Malabarba
You're right about indentation depending on the code being evaluated, but that's still better than nothing. ☺ People who do a significant amount of coding without a live session can still manually configure indentation like they currently do, and they're no worse off. The editor can even parse

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Colin Yates
Do you know about lein figwheel? On 22 Sep 2015 21:05, "Gary Trakhman" wrote: > Sometimes more than 0% when I'm doing something small in clojurescript, > can't be bothered with the setup, and browser refresh is good enough :-). > On Tue, Sep 22, 2015 at 4:02 PM Fluid

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Phillip Lord
Fluid Dynamics writes: > On Tuesday, September 22, 2015 at 6:31:34 AM UTC-4, Phillip Lord wrote: >> >> ... The interesting question then is what >> percentage of the time do Clojure developers work *without* a repl >> active. >> > > Uhhh, zero? :) Some I am sure. I do,

Re: Using metadata to specify how calls to a macro should be indented

2015-09-22 Thread Phillip Lord
Artur Malabarba writes: > Over at CIDER we're adding a feature where the author of a macro (or > function) can specify how that macro should be indented by adding an :indent > metadata to its definition. This way the editor (and other tools, like > cljfmt) will

Re: Using metadata to specify how calls to a macro should be indented

2015-09-19 Thread Artur Malabarba
Nice. It's good to see that it's so similar. Apparently they use a separate spec for grouping args as well. 2015-09-17 8:28 GMT+01:00 Jozef Wagner : > Dunaj uses metadata to guide IDEs and pretty printer regarding > indentations, arg grouping, ... > >

Re: Using metadata to specify how calls to a macro should be indented

2015-09-19 Thread Artur Malabarba
Hi Chas, This is a questionable proposal. It: > > * introduces completely orthogonal, transient concerns (presentation) into > code, ideally a canonical, long-lived source-of-truth > Yes, I'm ok with that. No one is better equipped to define a macro's indentation than it's author, and the

Re: Using metadata to specify how calls to a macro should be indented

2015-09-17 Thread Jozef Wagner
Dunaj uses metadata to guide IDEs and pretty printer regarding indentations, arg grouping, ... http://www.dunaj.org/metadata.html#_indentation http://www.dunaj.org/day10.html#_ide_support Jozef On Sunday, September 13, 2015 at 12:06:50 PM UTC+2, Artur Malabarba wrote: > > Hi everyone, > > >

Re: Using metadata to specify how calls to a macro should be indented

2015-09-16 Thread Artur Malabarba
2015-09-15 20:08 GMT+01:00 Josh Tilles : > I suspect that “Matching Socks” meant that there should be a standard > namespace, similar to how the recent Socket Server REPL design >

Re: Using metadata to specify how calls to a macro should be indented

2015-09-16 Thread Chas Emerick
Hi all; here to satisfy the quarterly quota to maintain my status as "that guy". This is a questionable proposal. It: * introduces completely orthogonal, transient concerns (presentation) into code, ideally a canonical, long-lived source-of-truth * sets up a bikeshed at the top of every def*

Re: Using metadata to specify how calls to a macro should be indented

2015-09-16 Thread Artur Malabarba
Hi Colin, it's great to get your thoughts on this. 2015-09-15 22:52 GMT+01:00 Colin Fleming : > I think it's important that the declaration of the formatting be separated > from the declaration of the macro itself. This allows forms which the > editor developer

Re: Using metadata to specify how calls to a macro should be indented

2015-09-16 Thread Colin Fleming
Unfortunately as tools developers we can't force our indentation preferences on our users, although I'd be fine with it if you convinced everyone to just use two spaces for everything, even though it's not my preferred formatting. Cursive has supported this for ages (copied from Emacs) but I don't

Re: Using metadata to specify how calls to a macro should be indented

2015-09-16 Thread Bozhidar Batsov
I'm kind of puzzled by the last couple of responses. Obviously very few forms (probably only macros) would have indentation specifications and editors can certainly disregard them, so I don't see the code being littered with indentation specs any time soon or some indentation being forced on

Re: Using metadata to specify how calls to a macro should be indented

2015-09-15 Thread Colin Fleming
This is an interesting proposal, and I like it in general. Everything in Cursive is based on extensions identified by the head form, like this: (style/register-formatting :clojure.core/def :only-indent) (style/register-formatting :clojure.core/defn- :only-indent) (style/register-formatting

Re: Using metadata to specify how calls to a macro should be indented

2015-09-15 Thread Josh Tilles
On Sunday, September 13, 2015 at 8:25:42 AM UTC-4, Artur Malabarba wrote: > > > On 13 Sep 2015 12:33 pm, "Matching Socks" > wrote: > > > > Unless clojure.core itself will carry these annotations, could the > keyword be namespaced? > > Or do you mean it should be ::indent?

Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Artur Malabarba
Hi everyone, Over at CIDER we're adding a feature where the author of a macro (or function) can specify how that macro should be indented by adding an :indent metadata to its definition. This way the editor (and other tools, like cljfmt) will know what's the proper way of indenting any

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Colin Yates
My knee-jerk reaction is: - +10 - leaving it up to the user is absolutely the right thing to do - the name ‘indent’ and what it is actually capturing are at different levels of abstraction. Possibly ‘structure’ might be a better name as that is what it is describing? But don’t listen to a

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Bozhidar Batsov
It's probably obvious, but let me say it just in case it isn't - I'm super supportive of Artur's idea. I've been thinking about something similar for a while and I believe deciding on something that's going to be used by many Clojure tools (CIDER, Cursive, fireplace, ccw, cljfmt, etc) will be

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Artur Malabarba
2015-09-13 11:15 GMT+01:00 Colin Yates : > - the name ‘indent’ and what it is actually capturing are at different > levels of abstraction. Possibly ‘structure’ might be a better name as that > is what it is describing? Good point, we should consider this. Though :structure

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Fluid Dynamics
On Sunday, September 13, 2015 at 12:10:00 PM UTC-4, Artur Malabarba wrote: > > > This scheme won't play nicely with forms with variable numbers of > special > > arguments. > > True, but I've never seen anyone indent specially these optional > arguments. For instance, every defn I see

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Matching Socks
Unless clojure.core itself will carry these annotations, could the keyword be namespaced? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Artur Malabarba
On 13 Sep 2015 1:25 pm, "Artur Malabarba" > Or do you mean it should be ::indent? Typo. Ignore the "Or". -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Fluid Dynamics
This scheme won't play nicely with forms with *variable numbers of special arguments*. Of which one is one of the most common macros to use: (defn foo [x] (+ x 3)) (defn bar "Adds four to x." [x] (+ x 4)) -- You received this message because you are subscribed to the

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Artur Malabarba
On 13 Sep 2015 12:33 pm, "Matching Socks" wrote: > > Unless clojure.core itself will carry these annotations, could the keyword be namespaced? Or do you mean it should be ::indent? (i.e., carry the namespace of the var that they're applied on) In this case, I think it would

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Artur Malabarba
> This scheme won't play nicely with forms with variable numbers of special > arguments. True, but I've never seen anyone indent specially these optional arguments. For instance, every defn I see (including clojure.core), is indented like this: (defn foo [x] (+ x 3)) (defn bar "Adds four

Re: Using metadata to specify how calls to a macro should be indented

2015-09-13 Thread Sean Grove
I also love this idea - the more info we give to tools to provide a uniform formatting, the less I have to worry about configuring my local editor to match the project styles. On Sun, Sep 13, 2015 at 3:15 AM, Colin Yates wrote: > My knee-jerk reaction is: > - +10 > -