Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indentation broken on emacs-24.0.50 #6

Closed
pmrb opened this issue Jun 15, 2011 · 10 comments
Closed

indentation broken on emacs-24.0.50 #6

pmrb opened this issue Jun 15, 2011 · 10 comments

Comments

@pmrb
Copy link

pmrb commented Jun 15, 2011

Hello,
When creating this file:

local test = [[bla bla bla
bla bla bla]]

there is no problem.

But after reopening this same file, it's no more possible to indent the second line (TAB-key).
No problem with emacs-23.x.
Peter

@immerrr
Copy link
Owner

immerrr commented Jun 24, 2011

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 ?

@pmrb
Copy link
Author

pmrb commented Jun 26, 2011

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 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.

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

@immerrr
Copy link
Owner

immerrr commented Jun 27, 2011

2011/6/26 pmrb <
reply@reply.github.com>

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

@pmrb
Copy link
Author

pmrb commented Jun 27, 2011

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

@immerrr
Copy link
Owner

immerrr commented Jun 27, 2011

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 file

But anyway: 23.X versions are no issue for me, I'm using 24.X.

Cheers,
Will see to this one too.

Cheers,
immerrr

immerrr added a commit that referenced this issue Sep 10, 2011
…able indenting multiline strings if necessary (issue #6)
@immerrr
Copy link
Owner

immerrr commented Sep 10, 2011

I've finally done what I had promised: here goes your defcustom to enable string contents indention. See if it works for you.

@pmrb
Copy link
Author

pmrb commented Sep 10, 2011

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

immerrr added a commit that referenced this issue Sep 29, 2011
…ative to indentation of the line where string/comment literal starts (issue #6)
@immerrr
Copy link
Owner

immerrr commented Sep 29, 2011

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.

@pmrb
Copy link
Author

pmrb commented Oct 3, 2011

On Thu, Sep 29 2011, immerrr wrote:

Hey, try now. Mostly it should work fine:

Yes, thanks!

       Peter

@immerrr
Copy link
Owner

immerrr commented Oct 3, 2011

Alright, closing

@immerrr immerrr closed this as completed Oct 3, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants