From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Brinkhoff Newsgroups: gmane.emacs.devel Subject: Re: Incorrect indentation after :name Date: Tue, 05 Jul 2005 21:44:33 +0200 Organization: nocrew Message-ID: <85vf3pt4v2.fsf@junk.nocrew.org> References: <42C80B48.3080103@student.lu.se> <87r7edhlsu.fsf-monnier+emacs@gnu.org> <85oe9hvih7.fsf@junk.nocrew.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120593576 27514 80.91.229.2 (5 Jul 2005 19:59:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 5 Jul 2005 19:59:36 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 05 21:59:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DptZe-0008E2-Ie for ged-emacs-devel@m.gmane.org; Tue, 05 Jul 2005 21:59:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dptav-0002qR-9r for ged-emacs-devel@m.gmane.org; Tue, 05 Jul 2005 16:00:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DptX0-0001fl-MJ for emacs-devel@gnu.org; Tue, 05 Jul 2005 15:56:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DptWu-0001bA-Jt for emacs-devel@gnu.org; Tue, 05 Jul 2005 15:56:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DptWp-0001WV-74 for emacs-devel@gnu.org; Tue, 05 Jul 2005 15:56:23 -0400 Original-Received: from [195.54.107.73] (helo=mxfep02.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DptRU-0000ZN-DM; Tue, 05 Jul 2005 15:50:52 -0400 Original-Received: from junk.nocrew.org ([213.115.110.229] [213.115.110.229]) by mxfep02.bredband.com with ESMTP id <20050705194433.DBYG21194.mxfep02.bredband.com@junk.nocrew.org>; Tue, 5 Jul 2005 21:44:33 +0200 Original-Received: from lars by junk.nocrew.org with local (Exim 4.50) id 1DptLN-0000HE-OO; Tue, 05 Jul 2005 21:44:33 +0200 Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Tue, 05 Jul 2005 15:11:42 -0400") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40453 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40453 "Richard M. Stallman" 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.