Subject: [clisp-list] lisp indentaion on console

From: Peter Wood <[email-masked]>
Date: Tue, 12 Jun 2001 09:57:02 +0200

Hi

I've written some functions which extend Readline to do lisp
indentation.  I put these functions in spvw.d before main(), and the
calls to readline (rl_add_defun) to register the functions after main.
They work ok, but my question is, is spvw.d a suitable place for this
sort of thing?  If they should go elsewhere, where would that be?

Regards,
Peter

---

From: Sam Steingold <[email-masked]>
Date: 12 Jun 2001 12:01:56 -0400

> * In message <[email-masked]>
> * On the subject of "[clisp-list] lisp indentaion on console"
> * Sent on Tue, 12 Jun 2001 09:57:02 +0200
> * Honorable Peter Wood <[email-masked]> writes:
>
> indentation.

what exactly do they do?
TAB does completion, so it cannot indent (like in Emacs).
You mean, indentation on RET?

> I put these functions in spvw.d before main(), and the calls to
> readline (rl_add_defun) to register the functions after main.  They
> work ok, but my question is, is spvw.d a suitable place for this sort
> of thing?  If they should go elsewhere, where would that be?

stream.d, near init_streamvars(), is probably better.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
Takeoffs are optional.  Landings are mandatory.

---

From: Peter Wood <[email-masked]>
Date: Wed, 13 Jun 2001 05:35:57 +0200

> You mean, indentation on RET?

No, I didn't want to mess around with RET, so I have made
lisp-indentation bindable to any of Readline's key sequences via
.inputrc. I am using ESC/ALT-i to indent, ESC-p to move up one virtual
line, and ESC-d to move down.

It's not "real" indentation, since it works by appending the correct
number of spaces to put the cursor in the position which TAB would do
in Emacs.  It represents Readline's 'physical' line as many virtual
lines of COLUMNS length, ie, a 'virtual' buffer.  It works because the
lisp reader ignores extra space. [ '(defun foo' and '( defun  foo    '
are the same thing.]

This means that automatic re-indenting after an xterm resize would be
tricky (to do properly).  However, It seems to work fine without
resizing, and in the console.  And it makes it *much* more readable.

I will try putting them in stream.d, as you suggest.

Regards,
Peter