Andrey Listopadov writes: > john muhl writes: > >> I agree there’s no immediate need. >> >> Could you explain what the lua-indent-* options do in lua-mode? I tried >> toggling them but didn’t see any difference between on/off. > > I don't really know it myself, sorry. There seem to be some specifics > regarding how the content inside parenthesis is indented, but I'm not > using these either. I found with the explanation of those options. >>> There are also some weirdness in semantic navigation, but it's more >>> likely that I'm just not used to new ts-backed navigation yet. >> >> I’m sure there is room for improvement here too. Suggestions welcome. > > Here are a few examples. the █ represents the point: Fixed in the attached. >>> If you're willing to dig into some (pretty crazy) involved examples, I >>> can send here some really convoluted nested anonymous functions that >>> currently are indented in a weird way in both modes. Neither does it >>> exactly right in my opiion, but I also don't know if there is the right >>> way to indent this. I can send these examples later this week once I >>> finish an article I'm working on rightnow. >> >> Sure. Whenever you have the time. > > I know, that this code is convoluted, and probably no one writes like > this, it was done on purpose for an article about the power of anonymous > functions, so perhaps it isn't really a problem for most Lua > programmers. But it makes reading code a bit harder in rare cases like > this. I have more examples in the article, feel free to grab them if you > need code snippets for testing: > > https://andreyor.st/posts/2023-09-26-iterator-based-transducers-in-lua/ Thanks. The patch gets pretty close on the partitioning function from your article (the mapping, filtering and taking functions indent correctly now). The trouble is that you end up with a tree like: (return_statement (expression_list (function_call (parenthesized_expression (function_definition (end)))))) with two different indent styles. return (function (f, ...) -- L7 end)(function (step) -- L14 return (function (...) -- L21 end)(collect(arr1, count1+1, ...)) -- L24 Is there some pattern for deciding that I’m missing? > Other than that, and the navigation issues I've mentioned above, the > mode works solidly. I've also noticed that some of the `lua-mode' > default shortcuts are missing, like `C-c C-f' > (lua-search-documentation) The opening a browser to look at the docs approach isn’t very Emacs-y so didn’t make the cut. Ideally it should integrate with info and/or eldoc but I haven’t gotten to it yet. This should get you by in the meantime: