Comments (10)
Hey, Peter
What you encounter is the intended (indented, sic!) behavior: multiline (ML) literals arent' recognized automatically right now, so nothing special happens when you 've just typed the literal in. When you do M-x lua-mark-all-multiline-literals
(bound to C-c C-;
by default) or reopen the file, the literal is recognized and avoids further indentation.
AFAIR, there's no special way whitespace is treated inside multiline literals, so, basically, all the indentation spaces would become part of the test
variable. This would mean that every time you'd change nesting of test
's point of definition, the amount of whitespace in it would change when reindented. I seriously doubt that's what one usually expects from string literals.
Now what's interesting, that you say there's no problem with emacs-23.x. Does this mean that emacs-23 still indents ML-strings ?
from lua-mode.
On Fri, Jun 24 2011, immerrr wrote:
AFAIR, there's no special way whitespace is treated inside multiline literals,
so, basically, all the indentation spaces would become part of thetest
variable. This would mean that every time you'd change nesting oftest
's
point of definition, the amount of whitespace in it would change when
reindented. I seriously doubt that's what one usually expects from string
literals.
Hello,
Right, there are 2 points of view:
1.) Whitespace at the beginning of a line matters in the application,
then you have to live with "not so beautiful" source code.
2.) Whitespace does not matter, then one could desire proper indentation
in multiline literals, so that the code looks nicer.
Some defcustom would be good.
Now what's interesting, that you say there's no problem with emacs-23.x. Does
this mean that emacs-23 still indents ML-strings ?
That must be an error, I cannot reproduce it...
Peter
from lua-mode.
2011/6/26 pmrb <
[email protected]>
On Fri, Jun 24 2011, immerrr wrote:
Hello,
Right, there are 2 points of view:
1.) Whitespace at the beginning of a line matters in the application,
then you have to live with "not so beautiful" source code.
2.) Whitespace does not matter, then one could desire proper indentation
in multiline literals, so that the code looks nicer.Some defcustom would be good.
That's agreeable terms and that's easy :). Will do in nearest future.
Now what's interesting, that you say there's no problem with emacs-23.x.
Does
this mean that emacs-23 still indents ML-strings ?That must be an error, I cannot reproduce it...
Well, if you have the opportunity to test at least for the exact version of
emacs-23 that exhibits currently wrong behavior, I'd be grateful. If not,
I'll do it myself, but not sure about how long will it take.
Cheers
from lua-mode.
On Mon, Jun 27 2011, immerrr wrote:
Some defcustom would be good.
That's agreeable terms and that's easy :). Will do in nearest future.
Thanks!
Now what's interesting, that you say there's no problem with emacs-23.x.
Does
this mean that emacs-23 still indents ML-strings ?That must be an error, I cannot reproduce it...
Well, if you have the opportunity to test at least for the exact version of
emacs-23 that exhibits currently wrong behavior, I'd be grateful. If not,
I'll do it myself, but not sure about how long will it take.
Now I see my error: I use 2 different systems with 2 different emacs
versions installed.
version 23.2.1: same behaviour as 24.0.50
version 23.1.1: still indents ML-strings even after re-opening the file
But anyway: 23.X versions are no issue for me, I'm using 24.X.
Cheers,
Peter
from lua-mode.
On 06/27/2011 02:03 PM, pmrb wrote:
Now I see my error: I use 2 different systems with 2 different emacs
versions installed.
version 23.2.1: same behaviour as 24.0.50
version 23.1.1: still indents ML-strings even after re-opening the fileBut anyway: 23.X versions are no issue for me, I'm using 24.X.
Cheers,
Will see to this one too.
Cheers,
immerrr
from lua-mode.
I've finally done what I had promised: here goes your defcustom to enable string contents indention. See if it works for you.
from lua-mode.
On Sat, Sep 10 2011, immerrr wrote:
I've finally done what I had promised: here goes your defcustom to enable
string contents indention. See if it works for you.
It works, but the indentation is always 0...
This is what I get:
--8<---------------cut here---------------start------------->8---
local test = [[bla bla bla bla bla
bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla]]
--8<---------------cut here---------------end--------------->8---
This is what I would expect:
--8<---------------cut here---------------start------------->8---
local test = [[bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla]]
--8<---------------cut here---------------end--------------->8---
or
--8<---------------cut here---------------start------------->8---
local test = [[bla bla bla bla bla bla bla
bla bla bla bla bla bla bla
bla bla bla bla bla bla bla]]
--8<---------------cut here---------------end--------------->8---
Thanks for your efforts,
Peter
from lua-mode.
Hey, try now. Mostly it should work fine:
local foo = [[
sdafsdf
sadfsadf
asdfasdf ]]
function bar(a,b)
local baz = [[
qux qux qux
quz quz quz
]]
end
Though it will fail in peculiar situations, like
if bar([[
foo
bar
]],
[[
foo
bar
]]) then
dosmth
end
Right now, I don't think it's worth investing more effort since the indentation engine overhaul is underway.
from lua-mode.
On Thu, Sep 29 2011, immerrr wrote:
Hey, try now. Mostly it should work fine:
Yes, thanks!
Peter
from lua-mode.
Alright, closing
from lua-mode.
Related Issues (20)
- 'local a =' makes '=' in warning face HOT 3
- Manually installation never working for emacs 27.0.90 HOT 3
- 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..."
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.