[ESS] SAS Indentation
Cameron Hooper
chooper at umich.edu
Thu Oct 27 18:41:32 CEST 2005
On Oct 26, 2005, at 5:39 PM, Rodney Sparapani wrote:
> Cameron Hooper wrote:
>
>> Some of the ESS indentation rules for SAS are not, in my opinion,
>> ideal. I realise this is very much a question of personal taste, but I
>> would like to raise the issue for discussion anyway. If this has been
>> discussed to death earlier, please accept my apologies in advance.
>> Here
>> are a series of examples. In each case I believe my preferred
>> indentation is closer to that used in the SAS documentation and in
>> many
>> books produced by the SAS institute.
>>
>>
>>
>>
> Cameron:
>
> auto-indentation is an emacs feature that I haven't seen many ESS[SAS]
> want or
> need. There are two reasons. 1) it doesn't seem to work that well and
> 2) there is
> no accepted standard style to enforce (most people have their own and
> don't want
> to fight something else with which is really annoying). So, the
> following two ESS[SAS]
> settings turn it off:
>
> (setq sas-indent-width 4)
> (setq ess-sas-edit-keys-toggle t)
>
> This may require some emacs settings as well like:
> (global-set-key [tab] 'tab-to-tab-stop)
> (global-set-key [return] 'newline)
>
> Rodney
>
I acknowledge your point. I certainly don't wish to impose my
formatting choices on other users.
I've done as you suggest. I note that C-TAB should move to the stop at
the left. I can't get this to work. C-TAB is not recognized. I suspect
this is similar to my earlier problem of not getting C-F8 etc to work.
Some keys just don't work for me. Is there some way I could bind this
behaviour to a different key combination?
Cameron
PS I would like a make a couple of comments about auto-indentation as
it stands. Ignore them if you wish :-) I promise I won't mention it
again.
First, I find that the auto-indentation feature is very useful. I
pointed out some problems but overall it is helpful.
Second, while there is no accepted standard, some of the
auto-indentation choices seem hard to explain. For example why is the
first line of data after a DATALINES statement indented differently
from all subsequent lines? This seems more like a bug than a feature.
Third, while I agree there is no accepted standard style, the SAS
documentation does seem to follow a consistent standard. For example,
in DO ... END blocks both key words are indented to the same level and
enclosed statements are indented one additional level. e.g
do i = 1 to 10;
y = 2;
end;
if i = 10 then
do;
y = 2;
end;
Do most users really prefer the following?
do i = 1 to 10;
y = 2;
end;
If so, fair enough. But I just want to confirm that this is intentional.
Fourth, SELECT statement don't seem to be auto-indented at all. It
seems inconsistent to apply auto-indenting to some statements but not
others.
C.
More information about the ESS-help
mailing list