emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Functionality to check current indentation status


From: Deniz Dogan
Subject: Re: Functionality to check current indentation status
Date: Wed, 13 Jan 2010 15:55:33 +0100

2010/1/13 Lennart Borgman <address@hidden>:
> On Wed, Jan 13, 2010 at 1:55 PM, Deniz Dogan <address@hidden> wrote:
>> Is there any generic functionality for checking whether a specific
>> line is indented appropriately according to major-mode? I mean other
>> than indenting it and seeing whether anything was modified.
>
> current-indentation
>

Thanks, but that only returns the current indentation with no
indication of whether indenting again will change anything. I'm
looking for something which will "automagically" understand the
language and return e.g. nil if and only if the current indentation is
incorrect. Having looked into indent.el I'm guessing something like
this doesn't exist today.

Naturally, such a function wouldn't work well in all modes, e.g.
Haskell modes where several different levels of indentation can be
correct, but in a lot of modes it would make sense, in my opinion.
(Basically any language where the syntax doesn't depend on the
presence of whitespaces.)

>> If not, it would be useful for e.g. a minor-mode which would highlight
>> lines that are not correctly indented, or for binding TAB to some
>> imaginary function indent-or-expand-abbrev, which would indent the
>> line if not already correct, otherwise call `expand-abbrev'.
>
> This is implemented in for example tabkey2-mode, but you always have
> to type on TAB for indentation first. I think it would be too
> confusing otherwise.
>
> Tabkey2 has a list of completion functions and try to use the relevant
> one. And let you change it just before you hit TAB again if you need
> to.
>
> See EmacsWiki for other alternatives.
>

Thank you, I'll look into it.

-- 
Deniz Dogan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]