Hi again, 2010/7/4 Lee Spector <lspec...@hampshire.edu>: > > [I'm not sure if the Clojure list is the right place for this, or if it > should go somewhere more specific to CCW -- please let me know if it's the > latter.]
There are more specific ccw-related mls, but if nobody complains, I suggest to continue this discussion where it begins: here. > > On Jun 29, 2010, at 2:41 PM, Laurent PETIT wrote: >> There's now auto-indentation (when you hit the Enter key). What is >> still missing is "bulk" reindentation (whole file at once). > > The important thing for me isn't "bulk" reindentation but rather the ability > to hit a key (e.g. tab) to re-indent an existing line of code. Right now this > is implemented in CCW but in strict mode only, as far as I can see. This > functionality is really useful because it helps to clean up badly formatted > code and -- most important for me -- to spot syntax errors when the > auto-indentation doesn't match the expected structure. So there are 2 possibilities: a. I create an additional "configuration parameter" so that anybody can choose if he wants the Tab key to behave "normally" or to be bound to the "reindent line" feature. And I make this "structural editing mode-independent". The next question is: which default state for this configuration parameter ? b. I move the feature back to "default mode". No additional configuration parameter. My preference would go for b. : I don't follow the "general rule" that providing options for everything gives more freedom to the user (choice paralysis syndrom), so I would prefer add configuration parameters where it is really important. Why do I think so ? I think that having tabs in a clojure source code editors makes no sense. All code conventions I know about concerning lisps say: use spaces, and use specifically 2 spaces as default indentation. Tabs in literal strings should be written as \t. Tabs in literal chars should be written as \tab. So where is there room for *real tabs* in clojure source code ? Even for column-like indentation (aligning values in a let), I guess that using spaces is more convenient when working with several people. What do you think ? What do other people think ? If people want a configuration parameter, I'll give them one. As Stuart said in another thread: speak now or ... :) > Is there a way to get this without the other features of the strict mode? I > don't personally like the other aspects of strict mode. For example when I > type a ")" I want to insert a ")", not to jump the cursor to another > location, and if I really want to delete a ")" then I really want to delete > it without jumping through hoops. Currently I can say that the strict mode is not totally feature complete. I intend to provide some "escape" key, which would allow "escaping the next typed character from the strict mode evaluation". This escape key may well end up being the Esc. key. If you were provided with this way to, some times, really add, insert or delete this damn ")", would you reexamine adopting the strict mode ? > I'm also experiencing some odd things if I have unbalanced brackets, which > can occur even with the automatic pair insertion if one types closing > brackets manually (which I'm doing by habit) or deletes text, etc. In strict > mode if I have a bare, unbalanced "]" on a line by itself, outside of any > definition, and then I hit tab on a line of code later in the buffer, then > that line *vanishes*. It's not just that it gets indented funny, as far as I > can tell -- it's just gone. That's pretty disconcerting. A bug? Oh, this for sure is a bug ! Lau Jensen opened an issue for it ( http://code.google.com/p/counterclockwise/issues/detail?id=114 ), which I was not able to reproduce on my side. With the help of this new input, I'll try to reproduce -and then eradicate- it! > In both modes auto-indentation seems to be oddly global, with a mismatched > bracket anywhere in the buffer turning off all auto-indentation everywhere. > In other lispy editors that I've used I think that the indentation has always > been determined only from the code *before* the cursor and only back to the > beginning of the current definition. That's, unfortunately, a current limitation of the implementation. We'll try to work on this, but give no promise for the short term. > I know talk is cheap and beggars can't be choosers, etc., but FWIW I would > prefer to have something close to the "default" mode but with tab (or some > other key) The default "reindent line" keyboard shortcut in Eclipse is Ctrl+I. Would this be acceptable to you ? I chose Tab because emacs did this, and I found this easier to type than Ctrl+I, given that we may type this quite a lot ? > working to re-indent the current line and with the indentation determined > only from the text before the insertion point, back to the beginning of the > current definition (as in emacs, etc.). I would also personally prefer to be > able to turn off automatic pair insertion entirely -- maybe I'll get used to > it, but I'm not at all sure about that (and if I do then I'll probably end up > leaving out closing brackets when I write code elsewhere...). Yes, in the default mode, I've had reports that the automatic insertion is getting tedious to work with, since you don't jump after the closing paren. Or maybe I could make it "jump after the closing paren" only if between the cursor and the closing paren, only spaces (or nothing at all) are present ? But I can already hear some people tell they really wanted to insert a new closing paren, ... :) > > Thanks so much for providing this tool and please don't take my suggestions > as complaints. I'm very happy to have this tool as it is and am just making > suggestions in the hopes that it can be improved. You're very welcome. Feedback is always appreciated. -- Laurent -- 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 - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en