Emacs scheme-mode indentation

This is a discussion on Emacs scheme-mode indentation within the Scheme forums in Programming Languages category; Is there a way to set the indentation rules for scheme-mode in emacs (21.4.1) just as they are for example in drscheme? The default ones are just bizzare : (define (function arg) (cond ((<condition>) ( <--------- after hitting <TAB>, emacs puts the caret in the position of the paren (the parentheses don't line up) (define (function arg) (cond ((<condition>) ( <------- I'd rather it to be like this (one character to the left). I've put a (put 'cond 'scheme-indent-function 10) in my .emacs but it didn't help (on the other hand the "if" special form is indented nicely (with (put ...

Go Back   Application Development Forum > Programming Languages > Scheme

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-16-2008, 04:05 PM
Juliusz.Gonera@gmail.com
Guest
 
Default Emacs scheme-mode indentation

Is there a way to set the indentation rules for scheme-mode in emacs
(21.4.1)
just as they are for example in drscheme?

The default ones are just bizzare :

(define (function arg)
(cond ((<condition>)
( <--------- after hitting <TAB>, emacs puts the caret
in the position of the paren (the parentheses don't line up)

(define (function arg)
(cond ((<condition>)
( <------- I'd rather it to be like this (one character
to the left).

I've put a (put 'cond 'scheme-indent-function 10) in my .emacs but it
didn't help (on the other hand the "if" special form is indented
nicely (with (put 'if 'scheme-indent-function 3))).
Reply With Quote
  #2  
Old 08-16-2008, 07:52 PM
Pascal J. Bourguignon
Guest
 
Default Re: Emacs scheme-mode indentation

"Juliusz.Gonera@gmail.com" <Juliusz.Gonera@gmail.com> writes:

> Is there a way to set the indentation rules for scheme-mode in emacs
> (21.4.1)
> just as they are for example in drscheme?
>
> The default ones are just bizzare :
>
> (define (function arg)
> (cond ((<condition>)
> ( <--------- after hitting <TAB>, emacs puts the caret
> in the position of the paren (the parentheses don't line up)
>
> (define (function arg)
> (cond ((<condition>)
> ( <------- I'd rather it to be like this (one character
> to the left).
>
> I've put a (put 'cond 'scheme-indent-function 10) in my .emacs but it
> didn't help (on the other hand the "if" special form is indented
> nicely (with (put 'if 'scheme-indent-function 3))).


The meaning of the number put in the scheme-indent-function property
is the number of _forms_ that shall be indented slightly more than the
normal body forms.

For example:

#+emacs (put 'my-operator 'scheme-indent-function 3)

(my-operator
a
b
c
d
e
f
g)

(my-operator a b
c
d
e
f
g)




I don't observe your bizarre behavior:

(define (function arg)
(cond (<condition>
<body>
<body>)
(<condition>
<body>
<body>)
(else
<body>
<body>)))


You should try paredit, it's really worthwhile an add-on to edit lisp
code in emacs. With paredit, I didn't even had to type any TAB for
the above examples, paredit-mode did indent automatically on RET.


--
__Pascal Bourguignon__ http://www.informatimago.com/

READ THIS BEFORE OPENING PACKAGE: According to certain suggested
versions of the Grand Unified Theory, the primary particles
constituting this product may decay to nothingness within the next
four hundred million years.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:41 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.