emacs-devel
[Top][All Lists]
Advanced

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

Re: Incorrect indentation after :name


From: Lars Brinkhoff
Subject: Re: Incorrect indentation after :name
Date: Tue, 05 Jul 2005 21:44:33 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

"Richard M. Stallman" <address@hidden> writes:
>     Somewhat related to this, I have a patch to improve indentation of
>     macros that are defined with defmacro* and uses &body.  The macro must
>     be loaded for my code to do its job.
>
> Could we manage to make this work without loading the macro?
> Perhaps by providing another place to find the information?

The code works by checking the position of &body inside the macro
argument list, and setting the lisp-indent-function property of the
macro name to that number.

This is the gist of the patch:

Index: lisp/emacs-lisp/cl-macs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/cl-macs.el,v
retrieving revision 1.53
diff -u -F^(def -r1.53 cl-macs.el
--- lisp/emacs-lisp/cl-macs.el  4 Jul 2005 17:33:35 -0000       1.53
+++ lisp/emacs-lisp/cl-macs.el  5 Jul 2005 19:37:39 -0000
@@ -202,8 +202,15 @@ (defmacro defmacro* (name args &rest bod
 
 \(fn NAME ARGLIST [DOCSTRING] BODY...)"
   (let* ((res (cl-transform-lambda (cons args body) name))
-        (form (list* 'defmacro name (cdr res))))
-    (if (car res) (list 'progn (car res) form) form)))
+        (form `((defmacro ,name ,@(cdr res)))))
+    (if (memq '&body args)
+       (push `(put ',name 'lisp-indent-function ,(position '&body args))
+             form))
+    (if (car res)
+       (push (car res) form))
+    (if (cdr form)
+       (cons 'progn form)
+       (car form))))
 
 (defmacro function* (func)
   "Introduce a function.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]