[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fred indentation

	   From: db@mcc.com (David Murray Bridgeland)
	   Is there a way to tell fred that certain sexps are to be
	   indented differently?  E.g. I'd like the following 
	   (flet ((foo (a b) (append (cdr a) (cdr b)))) 
	    (foo (foo z x) (foo x z)))
	   instead of 
	   (flet ((foo (a b) (append (cdr a) (cdr b)))) 
		 (foo (foo z x) (foo x z)))
	   How can I tell ed-indent-lisp about flet??
	The first form is what you currently get by the indenter.  This happens because
	(flet . 1) is on *fred-special-indent-alist*.  You can add additional symbols
	onto this list to affect their indenting.
	One thing you *won't* get any time soon is proper indenting of the subforms
	In other words, you will get
	  (flet ((foo (a b c)
	              (list a b c)))
	instead of the more desirable
	  (flet ((foo (a b c)
	          (list a b c)
	This limitations exists because fred's indentation parsing only searches
	back a single-level of s-expression, instead of two levels.  In the above
	example, it knows that '(list a b c) is inside a sublist which begins
	with 'foo, but it doesn't search back another level to see that this
	list is in turn contained within an flet.

I've been thinking about this recently. Is it possible to hook fred
indentation into xp? I haven't read the spec in detail yet, but it seems it
might be the thing to implement other niceties like styled lisp (function
names in bold etc...). The win of course is that then the specification of
how to print code are available to the user in  a more documented fashion,
and that the editor and the printer aren't as conceptually distinct.

Another application that I am thinking about is to write some xp code to output
a function in tex format (currently the only way to go is verbatim mode
with a fixed width font).