Complete emacs newbie here.
I'm using emacs 23.1.1 on Ubuntu with emacs starter kit. I primarily work in the lua-mode (installed with package-install lua-mode).
I need to tune how indentation works, so it would match my coding guidelines.
The guidelines are:
- tabs-to-spaces;
- two spaces per indent;
- 80 chars per line maximum, without trailing spaces.
Example:
local foo = function()
print("Hello, world!")
end
What I get with emacs if I don't try to fight with its auto-indent:
local foo = function()
print("Hello, world")
end
Update:
(This belongs to a comment, but since it needs extra formatting, I have to place it here.)
If I try solution by Thomas, I get this:
local foo = function()
print("Hello, world")
end
Note that end is indented with a tab and four spaces.
Does not quite work...
Update 2:
This thing is also gets indented in the wrong way:
local bar = foo(
"one",
"two",
baz(), -- Note three spaces
"quo"
)
It should be:
local bar = foo(
"one",
"two",
baz(),
"quo"
)
Update 3:
Third case of the wrong indentation:
local bar = foo(
"one",
"two"
)
local t = 5 -- This line should not be indented,
-- also note tab between local and t.
Update 4:
Here is what I get with the current version from Thomas:
local foo = function()
print("Hello, world")
end
local bar = 5 -- Emacs put \t before 5
local zzz = foo( -- Emacs put \t before foo
"one", -- Pressed TAB here twice