unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: emacs-devel@gnu.org
Subject: Re: Lisp indentation.
Date: Fri, 11 Mar 2005 02:29:32 +0100	[thread overview]
Message-ID: <873bv3as1v.fsf@xs4all.nl> (raw)
In-Reply-To: <jwvfyz3p9vh.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 10 Mar 2005 14:43:34 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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  <lute@gnu.org>
+ 
+ 	* 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  <monnier@iro.umontreal.ca>
  
  	* 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 <jwz@lucid.com>
  ;;	Hallvard Furuseth <hbf@ulrik.uio.no>
--- 1,6 ----
  ;;; byte-run.el --- byte-compiler support for inlining
  
! ;; Copyright (C) 1992, 2004, 2005  Free Software Foundation, Inc.
  
  ;; Author: Jamie Zawinski <jwz@lucid.com>
  ;;	Hallvard Furuseth <hbf@ulrik.uio.no>
***************
*** 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

  reply	other threads:[~2005-03-11  1:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-10 18:26 Lisp indentation Lute Kamstra
2005-03-10 19:43 ` Stefan Monnier
2005-03-11  1:29   ` Lute Kamstra [this message]
2005-03-12 17:40     ` Lute Kamstra
2005-03-13 13:23   ` Lute Kamstra
2005-03-13 13:51     ` Stefan Monnier
2005-03-13 16:29       ` Lute Kamstra
2005-03-14 12:58         ` Stefan Monnier
2005-03-14 13:55           ` Lute Kamstra
2005-03-14  3:00     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873bv3as1v.fsf@xs4all.nl \
    --to=lute.kamstra.lists@xs4all.nl \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).