[plt-scheme] Re: Useful Emacs code when working with PLT Scheme

From: Bill Clementson (bill_clementson at yahoo.com)
Date: Sun Dec 7 21:08:44 EST 2003

Guillaume Marceau
<gmarceau-9N4TdPD67tT2fBVCVOL8/A at public.gmane.org>
writes:

>   For list-related administrative tasks:
>  
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> 
> I use the following snipet. It reindent the whole
sexp under the
> cursor.
> 
>   (defun indent-current-sexp ()
>     (interactive)
>     (save-excursion
>       (unless (= (char-after) 40)
>         (up-list)
>         (backward-sexp))
>       (indent-according-to-mode)
>       (indent-sexp)))
> 
>   (add-hook 'scheme-mode-hook (lambda () (define-key
scheme-mode-map
>   "\C-\M-q" 'indent-current-sexp)))

Hey, neat! I actually use something similar but I just
defadvice the
indent-sexp function:

(defadvice indent-sexp (around indent-defun (&optional
endpos))
  "Indent the enclosing defun (or top-level sexp)."
  (interactive)
  (save-excursion
    (beginning-of-defun)
    ad-do-it))

(ad-activate 'indent-sexp)

--
Bill Clementson

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/


Posted on the users mailing list.