Giter Site home page Giter Site logo

Comments (10)

immerrr avatar immerrr commented on June 4, 2024

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.

pmrb avatar pmrb commented on June 4, 2024

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

from lua-mode.

immerrr avatar immerrr commented on June 4, 2024

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.

pmrb avatar pmrb commented on June 4, 2024

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.

immerrr avatar immerrr commented on June 4, 2024

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

from lua-mode.

immerrr avatar immerrr commented on June 4, 2024

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.

pmrb avatar pmrb commented on June 4, 2024

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.

immerrr avatar immerrr commented on June 4, 2024

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.

pmrb avatar pmrb commented on June 4, 2024

On Thu, Sep 29 2011, immerrr wrote:

Hey, try now. Mostly it should work fine:

Yes, thanks!

       Peter

from lua-mode.

immerrr avatar immerrr commented on June 4, 2024

Alright, closing

from lua-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.