bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] APL code indentation


From: Elias Mårtenson
Subject: Re: [Bug-apl] APL code indentation
Date: Tue, 27 May 2014 18:37:43 +0800

I'd like to follow up a little on my previous email. The documentation for 'tab-always-indent' says this:

This variable can be used to customize the behavior of the <TAB> (indent-for-tab-command) command. If the value is t (the default), the command normally just indents the current line. If the value is nil, the command indents the current line only if point is at the left margin or in the line's indentation; otherwise, it inserts a tab character. If the value is complete, the command first tries to indent the current line, and if the line was already indented, it calls completion-at-point to complete the text at point

(highlight mine)

gnu-apl-mode does something different here. Since it's quite common to want alternate indentation which can't be controlled by the mode itself, the line is always considered to be already indented if the cursor is not in the beginning of the line.

Regards,
Elias


On 27 May 2014 18:34, Elias Mårtenson <address@hidden> wrote:
You can use both. Just map TAM to normal tab insertion, and map a different key to 'completion-at-point'.

What probably messes things up for you is that my implementation of the indentation function only works when at the beginning of the line (technically, when there is nothing but whitespace between the cursor and the beginning of the line). If not, the function/variable expand is called (it will suggest the name of an existing variable if you type the first few letters).

Emacs at some point (24?) introduced a system where the indentation and expansion are integrated in the same framework. It allows you to control the behaviour of this by setting the variable 'tab-always-indent'.

That said... Personally, in modes that is not APL (for example, C and Lisp), I map C-TAB to the intelligent expand and use plain TAB purely for indentation. In these modes, the indentation and expand functions are separated. I think that is because they were implemented before the arrival of the unified system in Emacs.

Regards,
Elias


On 27 May 2014 18:24, Blake McBride <address@hidden> wrote:
When you edit an existing function, it would be nice if the initial display of the function had the indentation applied.

The enter key working for me - sort of.  It indents EVERY line by one character.  When I hit Enter at the end of the line, shouldn't it fix the line?

When editing a new function, the auto-indent doesn't doesn't get used on the very first line.

I don't like using the TAB key for this because then Emacs refuses to allow you to enter additional tabs at the beginning of the line.  (I know about ^q-tab but it is annoying).  I did, however, disable my preference to test your stuff.  

The Enter key at the end of the line should fix the indent of the current line and pre-indent the next.  It works this way for me in C mode but not in APL mode.  I'd rather have this than the TAB key.

Lines beginning with a comment should be moved to the left too.

Thanks!

Blake








On Tue, May 27, 2014 at 5:06 AM, Elias Mårtenson <address@hidden> wrote:
You are supposed to press TAB to indent. There is also electric indentation, which I normally have disabled, but it will automatically indent when you press RET.

Regards,
Elias


On 27 May 2014 18:03, Blake McBride <address@hidden> wrote:
Greetings,

I looked at the comments in your function.  Not only are labels typically moved one character to the left, but lines beginning with a comment are too.

I did a git pull.  When I edit a function, there is no indenting added at all.  Am I doing something wrong, or is there some other place I am suppose to see this?

Thanks.

Blake





On Tue, May 27, 2014 at 4:33 AM, Elias Mårtenson <address@hidden> wrote:
I've just implemented "intelligent" indentation support in gnu-apl-mode. I'm using quotes there because the rules are in fact very simple.

Could you guys share with me how you indent code, so that I can add the necessary configuration options to support whatever style you're using?


Regards,
Elias






reply via email to

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