emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/cl-indent.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/cl-indent.el
Date: Sun, 21 Jun 2009 01:17:00 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/06/21 01:16:59

Modified files:
        lisp           : ChangeLog 
        lisp/emacs-lisp: cl-indent.el 

Log message:
        (lisp-indent-defun-method, common-lisp-indent-function): Add doc 
strings.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15700&r2=1.15701
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/emacs-lisp/cl-indent.el?cvsroot=emacs&r1=1.55&r2=1.56

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15700
retrieving revision 1.15701
diff -u -b -r1.15700 -r1.15701
--- ChangeLog   19 Jun 2009 14:24:07 -0000      1.15700
+++ ChangeLog   21 Jun 2009 01:16:55 -0000      1.15701
@@ -1,3 +1,8 @@
+2009-06-21  Glenn Morris  <address@hidden>
+
+       * emacs-lisp/cl-indent.el (lisp-indent-defun-method)
+       (common-lisp-indent-function): Add doc strings.
+
 2009-06-19  David Casperson  <address@hidden>  (tiny change)
 
        * font-core.el (turn-on-font-lock-if-desired): Correctly handle

Index: emacs-lisp/cl-indent.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/cl-indent.el,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- emacs-lisp/cl-indent.el     5 Jan 2009 03:20:49 -0000       1.55
+++ emacs-lisp/cl-indent.el     21 Jun 2009 01:16:59 -0000      1.56
@@ -1,7 +1,7 @@
 ;;; cl-indent.el --- enhanced lisp-indent mode
 
-;; Copyright (C) 1987, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+;;   2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
 ;; Created: July 1987
@@ -103,7 +103,8 @@
 
 
 (defvar lisp-indent-error-function)
-(defvar lisp-indent-defun-method '(4 &lambda &body))
+(defvar lisp-indent-defun-method '(4 &lambda &body)
+  "Indentation for function with `common-lisp-indent-function' property 
`defun'.")
 
 
 (defun extended-loop-p (loop-start)
@@ -135,6 +136,75 @@
 
 ;;;###autoload
 (defun common-lisp-indent-function (indent-point state)
+  "Function to indent the arguments of a Lisp function call.
+This is suitable for use as the value of the variable
+`lisp-indent-function'.  INDENT-POINT is the point at which the
+indentation function is called, and STATE is the
+`parse-partial-sexp' state at that position.  Browse the
+`lisp-indent' customize group for options affecting the behavior
+of this function.
+
+If the indentation point is in a call to a Lisp function, that
+function's common-lisp-indent-function property specifies how
+this function should indent it.  Possible values for this
+property are:
+
+* defun, meaning indent according to `lisp-indent-defun-method';
+  i.e., like (4 &lambda &body), as explained below.
+
+* any other symbol, meaning a function to call.  The function should
+  take the arguments: PATH STATE INDENT-POINT SEXP-COLUMN NORMAL-INDENT.
+  PATH is a list of integers describing the position of point in terms of
+  list-structure with respect to the containing lists.  For example, in
+  ((a b c (d foo) f) g), foo has a path of (0 3 1).  In other words,
+  to reach foo take the 0th element of the outermost list, then
+  the 3rd element of the next list, and finally the 1st element.
+  STATE and INDENT-POINT are as in the arguments to
+  `common-lisp-indent-function'.  SEXP-COLUMN is the column of
+  the open parenthesis of the innermost containing list.
+  NORMAL-INDENT is the column the indentation point was
+  originally in.  This function should behave like `lisp-indent-259'.
+
+* an integer N, meaning indent the first N arguments like
+  function arguments, and any further arguments like a body.
+  This is equivalent to (4 4 ... &body).
+
+* a list.  The list element in position M specifies how to indent the Mth
+  function argument.  If there are fewer elements than function arguments,
+  the last list element applies to all remaining arguments.  The accepted
+  list elements are:
+
+  * nil, meaning the default indentation.
+
+  * an integer, specifying an explicit indentation.
+
+  * &lambda.  Indent the argument (which may be a list) by 4.
+
+  * &rest.  When used, this must be the penultimate element.  The
+    element after this one applies to all remaining arguments.
+
+  * &body.  This is equivalent to &rest lisp-body-indent, i.e., indent
+    all remaining elements by `lisp-body-indent'.
+
+  * &whole.  This must be followed by nil, an integer, or a
+    function symbol.  This indentation is applied to the
+    associated argument, and as a base indent for all remaining
+    arguments.  For example, an integer P means indent this
+    argument by P, and all remaining arguments by P, plus the
+    value specified by their associated list element.
+
+  * a symbol.  A function to call, with the 6 arguments specified above.
+
+  * a list, with elements as described above.  This applies when the
+    associated function argument is itself a list.  Each element of the list
+    specifies how to indent the associated argument.
+
+For example, the function `case' has an indent property
+\(4 &rest (&whole 2 &rest 1)), meaning:
+  * indent the first argument by 4.
+  * arguments after the first should be lists, and there may be any number
+    of them.  The first list element has an offset of 2, all the rest
+    have an offset of 2+1=3."
   (if (save-excursion (goto-char (elt state 1))
                      (looking-at "([Ll][Oo][Oo][Pp]"))
       (common-lisp-loop-part-indentation indent-point state)
@@ -149,6 +219,7 @@
           ;; Path describes the position of point in terms of
           ;;  list-structure with respect to containing lists.
           ;; `foo' has a path of (0 4 1) in `((a b c (d foo) f) g)'
+          ;; (Surely (0 3 1)?).
           (path ())
           ;; set non-nil when somebody works out the indentation to use
           calculated




reply via email to

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