From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: Lisp indentation. Date: Fri, 11 Mar 2005 02:29:32 +0100 Message-ID: <873bv3as1v.fsf@xs4all.nl> References: <87mztbmk6r.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1110505076 15040 80.91.229.2 (11 Mar 2005 01:37:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 01:37:56 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 11 02:37:56 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9Z63-0000Xj-Ox for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 02:37:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9ZHr-0003F0-Eu for ged-emacs-devel@m.gmane.org; Thu, 10 Mar 2005 20:49:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9ZGo-00038R-3D for emacs-devel@gnu.org; Thu, 10 Mar 2005 20:48:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9ZGS-0002x3-VZ for emacs-devel@gnu.org; Thu, 10 Mar 2005 20:48:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9ZGQ-0002td-QX for emacs-devel@gnu.org; Thu, 10 Mar 2005 20:48:30 -0500 Original-Received: from [194.109.24.30] (helo=smtp-vbr10.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D9Yy5-0007KU-6P for emacs-devel@gnu.org; Thu, 10 Mar 2005 20:29:33 -0500 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr10.xs4all.nl (8.12.11/8.12.11) with ESMTP id j2B1TWFi031805; Fri, 11 Mar 2005 02:29:32 +0100 (CET) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1D9Yy4-00031L-00; Fri, 11 Mar 2005 02:29:32 +0100 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Thu, 10 Mar 2005 14:43:34 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 176 X-Virus-Scanned: by XS4ALL Virus Scanner 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34445 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34445 Stefan Monnier writes: >> In about 25% of the cases the lisp-indent-hook property is used to >> specify the desired indentation and in the remaining 75% of the >> cases, the lisp-indent-function property is used. Is the second >> preferred? (The docsting of the function lisp-indent-function >> suggest this.) Should occurrences of lisp-indent-hook be renamed >> to lisp-indent-function? > > Yes, although there is no urgency. > >> In most cases the indentation property is put on the symbol at the >> place the symbol is defined. Symbols that are defined in C get >> their indentation property in lisp/emacs-lisp/lisp-mode.el. There >> are however a few symbols that are defined in lisp elsewhere that >> get their lisp-indent-function property set in lisp-mode.el. For >> example save-selected-window, save-match-data, and >> with-current-buffer. Is there some policy wrt the place where the >> indentation property should be set? > > I'd say they should be set in the `declare' part of the definition > of the macro. Ah, yes; I forgot about the declare thingy of macros. > See the definition of `when' or `unless' for examples. Unless it's > common to edit code that uses the macro while the macro itself is > not loaded, in which case it might be worthwhile to put the `put' in > some other file like lisp-mode.el. Thanks for clarifying. So this would be a good patch then. Lute. Index: lisp/ChangeLog =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.7083 diff -c -r1.7083 ChangeLog *** lisp/ChangeLog 10 Mar 2005 21:43:16 -0000 1.7083 --- lisp/ChangeLog 11 Mar 2005 01:17:36 -0000 *************** *** 1,3 **** --- 1,9 ---- + 2005-03-11 Lute Kamstra + + * emacs-lisp/byte-run.el: Replace lisp-indent-hook with + lisp-indent-function throughout. + (with-no-warnings): Set lisp-indent-function property. + 2005-03-10 Stefan Monnier * help.el (describe-mode): Properly handle non-trivial lighters. Index: lisp/emacs-lisp/byte-run.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/byte-run.el,v retrieving revision 1.6 diff -c -r1.6 byte-run.el *** lisp/emacs-lisp/byte-run.el 7 May 2004 00:58:54 -0000 1.6 --- lisp/emacs-lisp/byte-run.el 11 Mar 2005 01:17:37 -0000 *************** *** 1,6 **** ;;; byte-run.el --- byte-compiler support for inlining ! ;; Copyright (C) 1992, 2004 Free Software Foundation, Inc. ;; Author: Jamie Zawinski ;; Hallvard Furuseth --- 1,6 ---- ;;; byte-run.el --- byte-compiler support for inlining ! ;; Copyright (C) 1992, 2004, 2005 Free Software Foundation, Inc. ;; Author: Jamie Zawinski ;; Hallvard Furuseth *************** *** 34,40 **** ;; Redefined in byte-optimize.el. ;; This is not documented--it's not clear that we should promote it. (fset 'inline 'progn) ! (put 'inline 'lisp-indent-hook 0) ;;; Interface to inline functions. --- 34,40 ---- ;; Redefined in byte-optimize.el. ;; This is not documented--it's not clear that we should promote it. (fset 'inline 'progn) ! (put 'inline 'lisp-indent-function 0) ;;; Interface to inline functions. *************** *** 105,111 **** (put variable 'byte-obsolete-variable (cons new when)) variable) ! (put 'dont-compile 'lisp-indent-hook 0) (defmacro dont-compile (&rest body) "Like `progn', but the body always runs interpreted (not compiled). If you think you need this, you're probably making a mistake somewhere." --- 105,111 ---- (put variable 'byte-obsolete-variable (cons new when)) variable) ! (put 'dont-compile 'lisp-indent-function 0) (defmacro dont-compile (&rest body) "Like `progn', but the body always runs interpreted (not compiled). If you think you need this, you're probably making a mistake somewhere." *************** *** 118,124 **** ;;; definition in the file overrides the magic definitions on the ;;; byte-compile-macro-environment. ! (put 'eval-when-compile 'lisp-indent-hook 0) (defmacro eval-when-compile (&rest body) "Like `progn', but evaluates the body at compile time. The result of the body appears to the compiler as a quoted constant." --- 118,124 ---- ;;; definition in the file overrides the magic definitions on the ;;; byte-compile-macro-environment. ! (put 'eval-when-compile 'lisp-indent-function 0) (defmacro eval-when-compile (&rest body) "Like `progn', but evaluates the body at compile time. The result of the body appears to the compiler as a quoted constant." *************** *** 127,139 **** ;; (list 'quote (eval (cons 'progn body))) (cons 'progn body)) ! (put 'eval-and-compile 'lisp-indent-hook 0) (defmacro eval-and-compile (&rest body) "Like `progn', but evaluates the body at compile time and at load time." (declare (debug t)) ;; Remember, it's magic. (cons 'progn body)) (defun with-no-warnings (&rest body) "Like `progn', but prevents compiler warnings in the body." ;; The implementation for the interpreter is basically trivial. --- 127,140 ---- ;; (list 'quote (eval (cons 'progn body))) (cons 'progn body)) ! (put 'eval-and-compile 'lisp-indent-function 0) (defmacro eval-and-compile (&rest body) "Like `progn', but evaluates the body at compile time and at load time." (declare (debug t)) ;; Remember, it's magic. (cons 'progn body)) + (put 'with-no-warnings 'lisp-indent-function 0) (defun with-no-warnings (&rest body) "Like `progn', but prevents compiler warnings in the body." ;; The implementation for the interpreter is basically trivial. *************** *** 147,153 **** ;;; There is hardly any reason to change these parameters, anyway. ;;; --rms. ! ;; (put 'byte-compiler-options 'lisp-indent-hook 0) ;; (defmacro byte-compiler-options (&rest args) ;; "Set some compilation-parameters for this file. This will affect only the ;; file in which it appears; this does nothing when evaluated, and when loaded --- 148,154 ---- ;;; There is hardly any reason to change these parameters, anyway. ;;; --rms. ! ;; (put 'byte-compiler-options 'lisp-indent-function 0) ;; (defmacro byte-compiler-options (&rest args) ;; "Set some compilation-parameters for this file. This will affect only the ;; file in which it appears; this does nothing when evaluated, and when loaded