Comments (2)
I investigated a bit with a smaller example.
With:
(setq lua-indent-level 2)
(setq lua-indent-nested-block-content-align nil)
and starting with the sample code:
fun("sample", function (a, b)
print("hi")
end)
and point at the beginning of the second line (the one that starts with text print("hi")
.
The result was:
fun("sample", function (a, b)
print("hi")
end)
The result was an indentation by 4 spaces here and I think the expectation is that it should be 2 spaces.
I think this reproduces the reported behavior.
I tried tracing execution of lua-indent-line
with edebug to see why the result was 4
.
Roughly the overall flow appears to be:
lua-indent-line
lua-calculate-indentation
->4
lua-calculate-indentation-block-modifier
->4
lua-accumulate-indentation-info
->(absolute . 4)
lua-accumulate-indentation-info
->((relative . 2) (relative . 2) (absolute . 0))
I don't understand the details, but perhaps the above helps a bit with investigation (^^;
Also, this issue looked somewhat similar.
FWIW, I used Emacs 29.2 and it appears I'm using d074e41 of lua-mode
.
from lua-mode.
That's because function (a, b)
adds two spaces to the indentation on top of fun
which adds two spaces.
In emacs lua mode, indentation adds up. Indentation should not add up.
from lua-mode.
Related Issues (20)
- Please tag a new release HOT 4
- No highlighting in comment. HOT 5
- Very slow performance when inserting newlines HOT 5
- No license in the repository HOT 1
- sending whole buffer (lua-send-buffer) cause error
- Add an option to indent with tabs HOT 2
- unindenting 'end' without hitting RET HOT 2
- Indent lines of closers accroding to the first closer instead of the last closer HOT 3
- lua-send-buffer, unfinished string error HOT 1
- Extremely slow font-locking on lines with lots of dot operators HOT 1
- Extremely slow indentation inside tables HOT 3
- init-tryout ist distributed as part of the MELPA package
- Really bad performance while edit big lua table. HOT 3
- Support luacheck via Flymake HOT 1
- Indenting and new lines and other things I don't understand
- Indenting suggestion HOT 1
- Is there an option to highlight table keys?
- "Indenting region..."
- Make fails on MacOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-mode.