From: Jacek Generowicz
Subject: ILISP indentation
Date: 
Message-ID: <g0y9p2jwi6.fsf@scumbag.ecs.soton.ac.uk>
My Ilisp indents various with-stuff forms thus

(with-something-or-other (stuff)
                         (more-stuff . . .)
                         (other-stuff))

Elsewhere I tend to see

(with-something-or-other (stuff)
  (more-stuff . . .)
  (other-stuff))

Can I change Ilisp's behaviour to the latter ?

Would it be misguided ?

Jacek

From: Marco Antoniotti
Subject: Re: ILISP indentation
Date: 
Message-ID: <y6celqu9q4r.fsf@octagon.mrl.nyu.edu>
Jacek Generowicz <···@ecs.soton.ac.uk> writes:

> My Ilisp indents various with-stuff forms thus
> 
> (with-something-or-other (stuff)
>                          (more-stuff . . .)
>                          (other-stuff))
> 
> Elsewhere I tend to see
> 
> (with-something-or-other (stuff)
>   (more-stuff . . .)
>   (other-stuff))
> 
> Can I change Ilisp's behaviour to the latter ?

No, since ILISP does not do indentation :)

> Would it be misguided ?

No, but you have to check lisp-indent-function and its binding, which
is something outside ILISP.

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.
From: Tim Moore
Subject: Re: ILISP indentation
Date: 
Message-ID: <9kc21i$po6$0@216.39.145.192>
On 2 Aug 2001, Jacek Generowicz wrote:

> My Ilisp indents various with-stuff forms thus
> 
> (with-something-or-other (stuff)
>                          (more-stuff . . .)
>                          (other-stuff))
Ick :)

> Elsewhere I tend to see
> 
> (with-something-or-other (stuff)
>   (more-stuff . . .)
>   (other-stuff))
The one true way.

> Can I change Ilisp's behaviour to the latter ?
> 
> Would it be misguided ?

Not at all.
Make sure that lisp-indent-function is set to 'common-lisp-indent-function
in your lisp-mode-hook or wherever.  Then WITH-FOO forms are indented
correctly.

Tim
From: Jacek Generowicz
Subject: Re: ILISP indentation
Date: 
Message-ID: <g0zo9inuv1.fsf@scumbag.ecs.soton.ac.uk>
Tim Moore <·····@herschel.bricoworks.com> writes:

> On 2 Aug 2001, Jacek Generowicz wrote:
> 
> > My Ilisp indents various with-stuff forms thus
> > 
> > (with-something-or-other (stuff)
> >                          (more-stuff . . .)
> >                          (other-stuff))
> Ick :)

Exactly.

> > Elsewhere I tend to see
> > 
> > (with-something-or-other (stuff)
> >   (more-stuff . . .)
> >   (other-stuff))
> The one true way.

I'm glad.

> > Can I change Ilisp's behaviour to the latter ?
> > 
> > Would it be misguided ?
> 
> Not at all.
> Make sure that lisp-indent-function is set to 'common-lisp-indent-function
> in your lisp-mode-hook or wherever.  Then WITH-FOO forms are indented
> correctly.

Seems to do the trick . . .

(with-a-hey-and-a-ho (and a hey) 
  (nonny-no)) 
 
Thanks,

Jacek
From: Daniel Barlow
Subject: Re: ILISP indentation
Date: 
Message-ID: <87bslypgkr.fsf@noetbook.telent.net>
Jacek Generowicz <···@ecs.soton.ac.uk> writes:

> My Ilisp indents various with-stuff forms thus
> 
> (with-something-or-other (stuff)
>                          (more-stuff . . .)
>                          (other-stuff))

> Can I change [it] ?

Try using common-lisp-indent-function:

(add-hook 'lisp-mode-hook
	  '(lambda ()
	     (setq lisp-indent-function 'common-lisp-indent-function) ))

Seems to do a better job on with-foo functions.  Has anyone hacked it 
to recognise method combinations?  I want

(defmethod perform :after ((operation compile-system) (dso unix-dso))
  (let ((dso-name (unix-name (car (output-files operation dso)))))
    (if (zerop
	 (run-shell-command

instead of 

(defmethod perform :after ((operation compile-system) (dso unix-dso))
	   (let ((dso-name (unix-name (car (output-files operation dso)))))
	     (if (zerop
		  (run-shell-command

as it currently does

-dan

-- 

  http://ww.telent.net/cliki/ - Link farm for free CL-on-Unix resources 
From: Hannu Koivisto
Subject: Re: ILISP indentation
Date: 
Message-ID: <87zo9i9rna.fsf@lynx.ionific.com>
Daniel Barlow <···@telent.net> writes:

| Seems to do a better job on with-foo functions.  Has anyone hacked it 
| to recognise method combinations?  I want

XEmacs' cl-indent has been hacked to do that.

-- 
Hannu
From: Tim Moore
Subject: Re: ILISP indentation
Date: 
Message-ID: <9kcbsb$p2p$0@216.39.145.192>
On 2 Aug 2001, Hannu Koivisto wrote:

> Daniel Barlow <···@telent.net> writes:
> 
> | Seems to do a better job on with-foo functions.  Has anyone hacked it 
> | to recognise method combinations?  I want
> 
> XEmacs' cl-indent has been hacked to do that.

And the code works in Gnu Emacs too!  Cool.

(defun lisp-indent-defmethod (path state indent-point
                              sexp-column normal-indent)
  ;; Look for a method combination specifier...
  (let* ((combined (if (and (>= (car path) 3)
                            (null (cdr path)))
                       (save-excursion
                         (goto-char (car (cdr state)))
                         (forward-char)
                         (forward-sexp)
                         (forward-sexp)
                         (forward-sexp)
                         (backward-sexp)
                         (if (looking-at ":")
                             t
                             nil))
                       nil))
	 (method (if combined
		     '(4 4 (&whole 4 &rest 1) &body)
		     '(4 (&whole 4 &rest 1) &body))))
    (funcall (function lisp-indent-259)
	     method
	     path state indent-point sexp-column normal-indent)))
(put 'defmethod 'common-lisp-indent-function 'lisp-indent-defmethod)

Tim
From: Pierre R. Mai
Subject: Re: ILISP indentation
Date: 
Message-ID: <87n153lnjr.fsf@orion.bln.pmsf.de>
Tim Moore <·····@herschel.bricoworks.com> writes:

> On 2 Aug 2001, Hannu Koivisto wrote:
> 
> > Daniel Barlow <···@telent.net> writes:
> > 
> > | Seems to do a better job on with-foo functions.  Has anyone hacked it 
> > | to recognise method combinations?  I want
> > 
> > XEmacs' cl-indent has been hacked to do that.
> 
> And the code works in Gnu Emacs too!  Cool.
> 
> (defun lisp-indent-defmethod (path state indent-point
>                               sexp-column normal-indent)
>   ;; Look for a method combination specifier...
>   (let* ((combined (if (and (>= (car path) 3)
>                             (null (cdr path)))
>                        (save-excursion
>                          (goto-char (car (cdr state)))
>                          (forward-char)
>                          (forward-sexp)
>                          (forward-sexp)
>                          (forward-sexp)
>                          (backward-sexp)
>                          (if (looking-at ":")
>                              t
>                              nil))
>                        nil))
> 	 (method (if combined
> 		     '(4 4 (&whole 4 &rest 1) &body)
> 		     '(4 (&whole 4 &rest 1) &body))))
>     (funcall (function lisp-indent-259)
> 	     method
> 	     path state indent-point sexp-column normal-indent)))
> (put 'defmethod 'common-lisp-indent-function 'lisp-indent-defmethod)

And if you use the following definition, it will even recognize
non-keyword method-combination specifiers like progn, nconc, etc.

;;; Note that the following code assumes that lambda-lists are
;;; non-atomic, using #\( as the read-syntax for their construction.

(defun lisp-indent-defmethod (path state indent-point
                              sexp-column normal-indent)
  ;; Look for a method combination specifier...
  (let* ((combined (if (and (>= (car path) 3)
                            (null (cdr path)))
                       (save-excursion
                         (goto-char (car (cdr state)))
                         (forward-char)
                         (forward-sexp)
                         (forward-sexp)
                         (forward-sexp)
                         (backward-sexp)
                         (if (looking-at "(")
                             nil
                             t))
                       nil))
         (method (if combined
                     '(4 4 (&whole 4 &rest 1) &body)
                     '(4 (&whole 4 &rest 1) &body))))
    (funcall (function lisp-indent-259)
             method
             path state indent-point sexp-column normal-indent)))

Regs, Pierre.

-- 
Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein