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
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'.
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
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
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
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
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
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