aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-06-21 01:16:55 +0000
committerGlenn Morris2009-06-21 01:16:55 +0000
commit0ae8ebe848c4ca61cdbe95c86d84b5f0685ca5b1 (patch)
tree5320c515088e829c1517276e46c394e37090c4e0
parent4735b74e57b826ce25c9b03000eb181077a7c133 (diff)
downloademacs-0ae8ebe848c4ca61cdbe95c86d84b5f0685ca5b1.tar.gz
emacs-0ae8ebe848c4ca61cdbe95c86d84b5f0685ca5b1.zip
(lisp-indent-defun-method, common-lisp-indent-function): Add doc strings.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/cl-indent.el77
2 files changed, 79 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9953b4f3b2f..2d1dd7efc1b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-06-21 Glenn Morris <rgm@gnu.org>
2
3 * emacs-lisp/cl-indent.el (lisp-indent-defun-method)
4 (common-lisp-indent-function): Add doc strings.
5
12009-06-19 David Casperson <casper@unbc.ca> (tiny change) 62009-06-19 David Casperson <casper@unbc.ca> (tiny change)
2 7
3 * font-core.el (turn-on-font-lock-if-desired): Correctly handle 8 * font-core.el (turn-on-font-lock-if-desired): Correctly handle
diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index 16794ad7777..9efa43e07a4 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -1,7 +1,7 @@
1;;; cl-indent.el --- enhanced lisp-indent mode 1;;; cl-indent.el --- enhanced lisp-indent mode
2 2
3;; Copyright (C) 1987, 2000, 2001, 2002, 2003, 2004, 3;; Copyright (C) 1987, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4;; 2008, 2009 Free Software Foundation, Inc.
5 5
6;; Author: Richard Mlynarik <mly@eddie.mit.edu> 6;; Author: Richard Mlynarik <mly@eddie.mit.edu>
7;; Created: July 1987 7;; Created: July 1987
@@ -103,7 +103,8 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
103 103
104 104
105(defvar lisp-indent-error-function) 105(defvar lisp-indent-error-function)
106(defvar lisp-indent-defun-method '(4 &lambda &body)) 106(defvar lisp-indent-defun-method '(4 &lambda &body)
107 "Indentation for function with `common-lisp-indent-function' property `defun'.")
107 108
108 109
109(defun extended-loop-p (loop-start) 110(defun extended-loop-p (loop-start)
@@ -135,6 +136,75 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
135 136
136;;;###autoload 137;;;###autoload
137(defun common-lisp-indent-function (indent-point state) 138(defun common-lisp-indent-function (indent-point state)
139 "Function to indent the arguments of a Lisp function call.
140This is suitable for use as the value of the variable
141`lisp-indent-function'. INDENT-POINT is the point at which the
142indentation function is called, and STATE is the
143`parse-partial-sexp' state at that position. Browse the
144`lisp-indent' customize group for options affecting the behavior
145of this function.
146
147If the indentation point is in a call to a Lisp function, that
148function's common-lisp-indent-function property specifies how
149this function should indent it. Possible values for this
150property are:
151
152* defun, meaning indent according to `lisp-indent-defun-method';
153 i.e., like (4 &lambda &body), as explained below.
154
155* any other symbol, meaning a function to call. The function should
156 take the arguments: PATH STATE INDENT-POINT SEXP-COLUMN NORMAL-INDENT.
157 PATH is a list of integers describing the position of point in terms of
158 list-structure with respect to the containing lists. For example, in
159 ((a b c (d foo) f) g), foo has a path of (0 3 1). In other words,
160 to reach foo take the 0th element of the outermost list, then
161 the 3rd element of the next list, and finally the 1st element.
162 STATE and INDENT-POINT are as in the arguments to
163 `common-lisp-indent-function'. SEXP-COLUMN is the column of
164 the open parenthesis of the innermost containing list.
165 NORMAL-INDENT is the column the indentation point was
166 originally in. This function should behave like `lisp-indent-259'.
167
168* an integer N, meaning indent the first N arguments like
169 function arguments, and any further arguments like a body.
170 This is equivalent to (4 4 ... &body).
171
172* a list. The list element in position M specifies how to indent the Mth
173 function argument. If there are fewer elements than function arguments,
174 the last list element applies to all remaining arguments. The accepted
175 list elements are:
176
177 * nil, meaning the default indentation.
178
179 * an integer, specifying an explicit indentation.
180
181 * &lambda. Indent the argument (which may be a list) by 4.
182
183 * &rest. When used, this must be the penultimate element. The
184 element after this one applies to all remaining arguments.
185
186 * &body. This is equivalent to &rest lisp-body-indent, i.e., indent
187 all remaining elements by `lisp-body-indent'.
188
189 * &whole. This must be followed by nil, an integer, or a
190 function symbol. This indentation is applied to the
191 associated argument, and as a base indent for all remaining
192 arguments. For example, an integer P means indent this
193 argument by P, and all remaining arguments by P, plus the
194 value specified by their associated list element.
195
196 * a symbol. A function to call, with the 6 arguments specified above.
197
198 * a list, with elements as described above. This applies when the
199 associated function argument is itself a list. Each element of the list
200 specifies how to indent the associated argument.
201
202For example, the function `case' has an indent property
203\(4 &rest (&whole 2 &rest 1)), meaning:
204 * indent the first argument by 4.
205 * arguments after the first should be lists, and there may be any number
206 of them. The first list element has an offset of 2, all the rest
207 have an offset of 2+1=3."
138 (if (save-excursion (goto-char (elt state 1)) 208 (if (save-excursion (goto-char (elt state 1))
139 (looking-at "([Ll][Oo][Oo][Pp]")) 209 (looking-at "([Ll][Oo][Oo][Pp]"))
140 (common-lisp-loop-part-indentation indent-point state) 210 (common-lisp-loop-part-indentation indent-point state)
@@ -149,6 +219,7 @@ If nil, indent backquoted lists as data, i.e., like quoted lists."
149 ;; Path describes the position of point in terms of 219 ;; Path describes the position of point in terms of
150 ;; list-structure with respect to containing lists. 220 ;; list-structure with respect to containing lists.
151 ;; `foo' has a path of (0 4 1) in `((a b c (d foo) f) g)' 221 ;; `foo' has a path of (0 4 1) in `((a b c (d foo) f) g)'
222 ;; (Surely (0 3 1)?).
152 (path ()) 223 (path ())
153 ;; set non-nil when somebody works out the indentation to use 224 ;; set non-nil when somebody works out the indentation to use
154 calculated 225 calculated