[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp indentation.
From: |
Lute Kamstra |
Subject: |
Re: Lisp indentation. |
Date: |
Fri, 11 Mar 2005 02:29:32 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> 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 <address@hidden>
+
+ * 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 <address@hidden>
* 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 <address@hidden>
;; Hallvard Furuseth <address@hidden>
--- 1,6 ----
;;; byte-run.el --- byte-compiler support for inlining
! ;; Copyright (C) 1992, 2004, 2005 Free Software Foundation, Inc.
;; Author: Jamie Zawinski <address@hidden>
;; Hallvard Furuseth <address@hidden>
***************
*** 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