[comp.emacs] lisp-indent-hook question, and other hooks

phs@lifia.UUCP (Philippe Schnoebelen) (09/28/87)

   Customizing the indentation behavior of a given Lisp symbol is very easy
with GNU Emacs: one just has to change the lisp-indent-hook property of the
symbol. Well, this is easy in some cases, depending on what you  are trying
to  achieve.  My  problem is  with   Common Lisp's  "flet"  (or  labels  or
macrolet). What Emacs gives is something like that:

	(flet ((function1 (x y z)
			  (body1)
			  (...))
	       (function2 ()			(Fig. 1)
			  (body2)
			  (...)))
	  (flet-body)
	  (...))

while I would prefer

	(flet ((function1 (x y z)
		 (body1)
		 (...))				(Fig. 2)
	       (function2 ()
		 (body2)
		 (...)))
	  (flet-body)
	  (...))

   This does not fall into any of the three main styles of Lisp indentation
for which it is  easy to customize  GNU  Emacs,  and thus it   becomes very
complicated  to obtain it. Of course,  it is possible  to obtain  it (it is
always possible: you have the source :-), simply it is not at  all easy, so
much that I've never really tried to do it ...

   Have you written such a lisp-indent-fletform ? In such a case, would you
accept to share it ? I think  it would be useful for  every Lisp programmer
working with GNU Emacs because I cannot  imagine someone accepting (Fig. 1)
in  his programs ! I  even think this  should  be  included into GNU Emacs,
because  automatically indenting  Lisp programs has  always  been  done  by
emacses. Thanks in advance.


   Still about hooks, I was disappointed to see that there  is no  (I mean,
not yet any) fundamental-mode-hook ! How  can I  automatically edit any new
file in ABBREV-MODE ?

--
Philippe SCHNOEBELEN,				Best:        phs@lifia.imag.fr
LIFIA - INPG,
46, Avenue Felix VIALLET			2nd:		phs@lifia.UUCP
38000 Grenoble, FRANCE				last: ..!mcvax!inria!lifia!phs

"Algebraic symbols are used when you do not know what you are talking about."

gaynor@topaz.rutgers.edu.UUCP (09/30/87)

> Still about hooks, I was disappointed to see that there is no (I
> mean, not yet any) fundamental-mode-hook ! How can I automatically
> edit any new file in ABBREV-MODE ?

I could swear I gave this topic a fair discussion not two weeks ago.
Check out archives for a slightly more complete discussion.  But
because I think this is a flaw (albeit minor) in GNU Emacs, here is
the fundamental-mode-hook stuff again.

;; Define fundamental-mode to evaluate a hook, fundamental-mode-hook.
(fset 'fundamental-mode
  (append (symbol-function 'fundamental-mode)
	  '((run-hooks 'fundamental-mode-hook))))
(defvar fundamental-mode-hook nil
"Function post-evaluated when fundamental-mode is entered.  Hi Mom!"

Enjoy,                          Look!!
Silver.                           |
                                 \|/
                                  V
***********************************************************************
* LOOKING FOR ENTRY-LEVELISH C/LISP PROGRAMMING, SOFTWARE ENGINEERING *
***********************************************************************
  Andy Gaynor   201-545-0458   81 Hassart St, New Brunswick, NJ 08901
    gaynor@topaz.rutgers.edu   ...!rutgers!topaz.rutgers.edu!gaynor
       "There is no Editor but Emacs, and Lisp is its Prophet."

ram-ashwin@YALE.ARPA.UUCP (10/01/87)

>                         I think  it would be useful for  every Lisp programmer
>    working with GNU Emacs because I cannot  imagine someone accepting (Fig. 1)
>    in  his programs !> 

I'd certainly use it to indent LABELS in T/Scheme.  

>       Still about hooks, I was disappointed to see that there  is no  (I mean,
>    not yet any) fundamental-mode-hook ! How  can I  automatically edit any new
>    file in ABBREV-MODE ?

Try setting the variable default-major-mode.  (This is independent of the
issue of the existence of fundamental-mode-hook, of course.)

-- Ashwin Ram --

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,linus,seismo}!yale!Ram-Ashwin
BITNET:  Ram@yalecs

nate@cpocd2.UUCP (Nathan Hess) (10/01/87)

In article <2884@lifia.UUCP> phs@lifia.UUCP (Philippe Schnoebelen) writes:
>   Still about hooks, I was disappointed to see that there  is no  (I mean,
>not yet any) fundamental-mode-hook ! How  can I  automatically edit any new
>file in ABBREV-MODE ?

If you want a hook for editing files which are new, check out
'find-file-not-found-hooks'; this should be something like what you
want, and it will work indeendently of what mode the new buffer is.

Good luck!
--woodstock
-- 
	   "How did you get your mind to tilt like your hat?"

...!{decwrl|hplabs!oliveb|pur-ee|qantel|amd}!intelca!mipos3!cpocd2!nate
<domainish> :   nate@cpocd2.intel.com		ATT :    (602) 961-2037