Mercurial > emacs
annotate lisp/emacs-lisp/cl-indent.el @ 22477:9bc88c123895 gcc-2_8_1-980627 gcc-2_8_1-980705 gcc-2_8_1-980718 libc-980614 libc-980615 libc-980616 libc-980617 libc-980618 libc-980619 libc-980620 libc-980621 libc-980622 libc-980623 libc-980624 libc-980625 libc-980626 libc-980627 libc-980628 libc-980629 libc-980630 libc-980701 libc-980702 libc-980703 libc-980704 libc-980705 libc-980706 libc-980707 libc-980708 libc-980709 libc-980710 libc-980711 libc-980712 libc-980713 libc-980714 libc-980715 libc-980716 libc-980717 libc-980718 libc-980719
(sun4H:SunOS:5.*:*): New case.
author | Richard Kenner <kenner@gnu.org> |
---|---|
date | Sat, 13 Jun 1998 19:51:10 +0000 |
parents | b95ba3830bc9 |
children | 776e56dbde3c |
rev | line source |
---|---|
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
1 ;;; cl-indent.el --- enhanced lisp-indent mode |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
2 |
257 | 3 ;; Copyright (C) 1987 Free Software Foundation, Inc. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
4 |
14040 | 5 ;; Author: Richard Mlynarik <mly@eddie.mit.edu> |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
6 ;; Created: July 1987 |
845 | 7 ;; Maintainer: FSF |
8 ;; Keywords: lisp, tools | |
9 | |
257 | 10 ;; This file is part of GNU Emacs. |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
257 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
257 | 26 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
27 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
28 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
29 ;; This package supplies a single entry point, common-lisp-indent-function, |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
30 ;; which performs indentation in the preferred style for Common Lisp code. |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
31 ;; To enable it: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
32 ;; |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
33 ;; (setq lisp-indent-function 'common-lisp-indent-function) |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
845
diff
changeset
|
34 |
257 | 35 ;;>> TODO |
36 ;; :foo | |
37 ;; bar | |
38 ;; :baz | |
39 ;; zap | |
40 ;; &key (like &body)?? | |
41 | |
42 ;; &rest 1 in lambda-lists doesn't work | |
43 ;; -- really want (foo bar | |
44 ;; baz) | |
45 ;; not (foo bar | |
46 ;; baz) | |
47 ;; Need something better than &rest for such cases | |
48 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
662
diff
changeset
|
49 ;;; Code: |
257 | 50 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
51 (defgroup lisp-indent nil |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
52 "Indentation in Lisp" |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
53 :group 'lisp) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
54 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
55 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
56 (defcustom lisp-indent-maximum-backtracking 3 |
257 | 57 "*Maximum depth to backtrack out from a sublist for structured indentation. |
58 If this variable is 0, no backtracking will occur and forms such as flet | |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
59 may not be correctly indented." |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
60 :type 'integer |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
61 :group 'lisp-indent) |
257 | 62 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
63 (defcustom lisp-tag-indentation 1 |
257 | 64 "*Indentation of tags relative to containing list. |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
65 This variable is used by the function `lisp-indent-tagbody'." |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
66 :type 'integer |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
67 :group 'lisp-indent) |
257 | 68 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
69 (defcustom lisp-tag-body-indentation 3 |
257 | 70 "*Indentation of non-tagged lines relative to containing list. |
71 This variable is used by the function `lisp-indent-tagbody' to indent normal | |
72 lines (lines without tags). | |
73 The indentation is relative to the indentation of the parenthesis enclosing | |
74 the special form. If the value is t, the body of tags will be indented | |
75 as a block at the same indentation as the first s-expression following | |
76 the tag. In this case, any forms before the first tag are indented | |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
77 by `lisp-body-indent'." |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
78 :type 'integer |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
79 :group 'lisp-indent) |
257 | 80 |
81 | |
22212
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
82 (defvar lisp-indent-error-function) |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
83 |
257 | 84 ;;;###autoload |
85 (defun common-lisp-indent-function (indent-point state) | |
86 (let ((normal-indent (current-column))) | |
87 ;; Walk up list levels until we see something | |
88 ;; which does special things with subforms. | |
89 (let ((depth 0) | |
90 ;; Path describes the position of point in terms of | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2307
diff
changeset
|
91 ;; list-structure with respect to containing lists. |
257 | 92 ;; `foo' has a path of (0 4 1) in `((a b c (d foo) f) g)' |
93 (path ()) | |
94 ;; set non-nil when somebody works out the indentation to use | |
95 calculated | |
96 (last-point indent-point) | |
97 ;; the position of the open-paren of the innermost containing list | |
98 (containing-form-start (elt state 1)) | |
99 ;; the column of the above | |
100 sexp-column) | |
101 ;; Move to start of innermost containing list | |
102 (goto-char containing-form-start) | |
103 (setq sexp-column (current-column)) | |
104 ;; Look over successively less-deep containing forms | |
105 (while (and (not calculated) | |
106 (< depth lisp-indent-maximum-backtracking)) | |
107 (let ((containing-sexp (point))) | |
108 (forward-char 1) | |
109 (parse-partial-sexp (point) indent-point 1 t) | |
110 ;; Move to the car of the relevant containing form | |
111 (let (tem function method) | |
112 (if (not (looking-at "\\sw\\|\\s_")) | |
113 ;; This form doesn't seem to start with a symbol | |
114 (setq function nil method nil) | |
115 (setq tem (point)) | |
116 (forward-sexp 1) | |
117 (setq function (downcase (buffer-substring tem (point)))) | |
118 (goto-char tem) | |
119 (setq tem (intern-soft function) | |
120 method (get tem 'common-lisp-indent-function)) | |
121 (cond ((and (null method) | |
122 (string-match ":[^:]+" function)) | |
123 ;; The pleblisp package feature | |
124 (setq function (substring function | |
125 (1+ (match-beginning 0))) | |
126 method (get (intern-soft function) | |
127 'common-lisp-indent-function))) | |
128 ((and (null method)) | |
129 ;; backwards compatibility | |
130 (setq method (get tem 'lisp-indent-function))))) | |
131 (let ((n 0)) | |
132 ;; How far into the containing form is the current form? | |
133 (if (< (point) indent-point) | |
134 (while (condition-case () | |
135 (progn | |
136 (forward-sexp 1) | |
137 (if (>= (point) indent-point) | |
138 nil | |
139 (parse-partial-sexp (point) | |
140 indent-point 1 t) | |
141 (setq n (1+ n)) | |
142 t)) | |
143 (error nil)))) | |
144 (setq path (cons n path))) | |
145 | |
146 ;; backwards compatibility. | |
147 (cond ((null function)) | |
148 ((null method) | |
149 (if (null (cdr path)) | |
150 ;; (package prefix was stripped off above) | |
151 (setq method (cond ((string-match "\\`def" | |
152 function) | |
153 '(4 (&whole 4 &rest 1) &body)) | |
154 ((string-match "\\`\\(with\\|do\\)-" | |
155 function) | |
156 '(4 &body)))))) | |
157 ;; backwards compatibility. Bletch. | |
158 ((eq method 'defun) | |
159 (setq method '(4 (&whole 4 &rest 1) &body)))) | |
160 | |
161 (cond ((and (memq (char-after (1- containing-sexp)) '(?\' ?\`)) | |
162 (not (eql (char-after (- containing-sexp 2)) ?\#))) | |
163 ;; No indentation for "'(...)" elements | |
164 (setq calculated (1+ sexp-column))) | |
165 ((or (eql (char-after (1- containing-sexp)) ?\,) | |
166 (and (eql (char-after (1- containing-sexp)) ?\@) | |
167 (eql (char-after (- containing-sexp 2)) ?\,))) | |
168 ;; ",(...)" or ",@(...)" | |
169 (setq calculated normal-indent)) | |
170 ((eql (char-after (1- containing-sexp)) ?\#) | |
171 ;; "#(...)" | |
172 (setq calculated (1+ sexp-column))) | |
173 ((null method)) | |
174 ((integerp method) | |
175 ;; convenient top-level hack. | |
176 ;; (also compatible with lisp-indent-function) | |
177 ;; The number specifies how many `distinguished' | |
178 ;; forms there are before the body starts | |
179 ;; Equivalent to (4 4 ... &body) | |
180 (setq calculated (cond ((cdr path) | |
181 normal-indent) | |
182 ((<= (car path) method) | |
183 ;; `distinguished' form | |
184 (list (+ sexp-column 4) | |
185 containing-form-start)) | |
186 ((= (car path) (1+ method)) | |
187 ;; first body form. | |
188 (+ sexp-column lisp-body-indent)) | |
189 (t | |
190 ;; other body form | |
191 normal-indent)))) | |
192 ((symbolp method) | |
22212
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
193 (let ((lisp-indent-error-function function)) |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
194 (setq calculated (funcall method |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
195 path state indent-point |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
196 sexp-column normal-indent)))) |
257 | 197 (t |
22212
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
198 (let ((lisp-indent-error-function function)) |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
199 (setq calculated (lisp-indent-259 |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
200 method path state indent-point |
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
201 sexp-column normal-indent)))))) |
257 | 202 (goto-char containing-sexp) |
203 (setq last-point containing-sexp) | |
204 (if (not calculated) | |
205 (condition-case () | |
206 (progn (backward-up-list 1) | |
207 (setq depth (1+ depth))) | |
208 (error (setq depth lisp-indent-maximum-backtracking)))))) | |
209 calculated))) | |
210 | |
211 | |
212 (defun lisp-indent-report-bad-format (m) | |
213 (error "%s has a badly-formed %s property: %s" | |
214 ;; Love those free variable references!! | |
22212
b95ba3830bc9
(lisp-indent-error-function): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
22180
diff
changeset
|
215 lisp-indent-error-function 'common-lisp-indent-function m)) |
257 | 216 |
217 ;; Blame the crufty control structure on dynamic scoping | |
218 ;; -- not on me! | |
219 (defun lisp-indent-259 (method path state indent-point | |
220 sexp-column normal-indent) | |
221 (catch 'exit | |
222 (let ((p path) | |
223 (containing-form-start (elt state 1)) | |
224 n tem tail) | |
225 ;; Isn't tail-recursion wonderful? | |
226 (while p | |
227 ;; This while loop is for destructuring. | |
228 ;; p is set to (cdr p) each iteration. | |
229 (if (not (consp method)) (lisp-indent-report-bad-format method)) | |
230 (setq n (1- (car p)) | |
231 p (cdr p) | |
232 tail nil) | |
233 (while n | |
234 ;; This while loop is for advancing along a method | |
235 ;; until the relevant (possibly &rest/&body) pattern | |
236 ;; is reached. | |
237 ;; n is set to (1- n) and method to (cdr method) | |
238 ;; each iteration. | |
239 (setq tem (car method)) | |
240 | |
241 (or (eq tem 'nil) ;default indentation | |
242 ; (eq tem '&lambda) ;abbrev for (&whole 4 (&rest 1)) | |
243 (and (eq tem '&body) (null (cdr method))) | |
244 (and (eq tem '&rest) | |
245 (consp (cdr method)) (null (cdr (cdr method)))) | |
246 (integerp tem) ;explicit indentation specified | |
247 (and (consp tem) ;destructuring | |
248 (eq (car tem) '&whole) | |
249 (or (symbolp (car (cdr tem))) | |
250 (integerp (car (cdr tem))))) | |
251 (and (symbolp tem) ;a function to call to do the work. | |
252 (null (cdr method))) | |
253 (lisp-indent-report-bad-format method)) | |
254 | |
255 (cond ((and tail (not (consp tem))) | |
256 ;; indent tail of &rest in same way as first elt of rest | |
257 (throw 'exit normal-indent)) | |
258 ((eq tem '&body) | |
259 ;; &body means (&rest <lisp-body-indent>) | |
260 (throw 'exit | |
261 (if (and (= n 0) ;first body form | |
262 (null p)) ;not in subforms | |
263 (+ sexp-column | |
264 lisp-body-indent) | |
265 normal-indent))) | |
266 ((eq tem '&rest) | |
267 ;; this pattern holds for all remaining forms | |
268 (setq tail (> n 0) | |
269 n 0 | |
270 method (cdr method))) | |
271 ((> n 0) | |
272 ;; try next element of pattern | |
273 (setq n (1- n) | |
274 method (cdr method)) | |
275 (if (< n 0) | |
276 ;; Too few elements in pattern. | |
277 (throw 'exit normal-indent))) | |
278 ((eq tem 'nil) | |
279 (throw 'exit (list normal-indent containing-form-start))) | |
280 ; ((eq tem '&lambda) | |
281 ; ;; abbrev for (&whole 4 &rest 1) | |
282 ; (throw 'exit | |
283 ; (cond ((null p) | |
284 ; (list (+ sexp-column 4) containing-form-start)) | |
285 ; ((null (cdr p)) | |
286 ; (+ sexp-column 1)) | |
287 ; (t normal-indent)))) | |
288 ((integerp tem) | |
289 (throw 'exit | |
290 (if (null p) ;not in subforms | |
291 (list (+ sexp-column tem) containing-form-start) | |
292 normal-indent))) | |
293 ((symbolp tem) ;a function to call | |
294 (throw 'exit | |
295 (funcall tem path state indent-point | |
296 sexp-column normal-indent))) | |
297 (t | |
298 ;; must be a destructing frob | |
299 (if (not (null p)) | |
300 ;; descend | |
301 (setq method (cdr (cdr tem)) | |
302 n nil) | |
303 (setq tem (car (cdr tem))) | |
304 (throw 'exit | |
305 (cond (tail | |
306 normal-indent) | |
307 ((eq tem 'nil) | |
308 (list normal-indent | |
309 containing-form-start)) | |
310 ((integerp tem) | |
311 (list (+ sexp-column tem) | |
312 containing-form-start)) | |
313 (t | |
314 (funcall tem path state indent-point | |
315 sexp-column normal-indent)))))))))))) | |
316 | |
317 (defun lisp-indent-tagbody (path state indent-point sexp-column normal-indent) | |
318 (if (not (null (cdr path))) | |
319 normal-indent | |
320 (save-excursion | |
321 (goto-char indent-point) | |
322 (beginning-of-line) | |
323 (skip-chars-forward " \t") | |
324 (list (cond ((looking-at "\\sw\\|\\s_") | |
325 ;; a tagbody tag | |
326 (+ sexp-column lisp-tag-indentation)) | |
327 ((integerp lisp-tag-body-indentation) | |
328 (+ sexp-column lisp-tag-body-indentation)) | |
329 ((eq lisp-tag-body-indentation 't) | |
330 (condition-case () | |
331 (progn (backward-sexp 1) (current-column)) | |
332 (error (1+ sexp-column)))) | |
333 (t (+ sexp-column lisp-body-indent))) | |
334 ; (cond ((integerp lisp-tag-body-indentation) | |
335 ; (+ sexp-column lisp-tag-body-indentation)) | |
336 ; ((eq lisp-tag-body-indentation 't) | |
337 ; normal-indent) | |
338 ; (t | |
339 ; (+ sexp-column lisp-body-indent))) | |
340 (elt state 1) | |
341 )))) | |
342 | |
343 (defun lisp-indent-do (path state indent-point sexp-column normal-indent) | |
344 (if (>= (car path) 3) | |
345 (let ((lisp-tag-body-indentation lisp-body-indent)) | |
346 (funcall (function lisp-indent-tagbody) | |
347 path state indent-point sexp-column normal-indent)) | |
348 (funcall (function lisp-indent-259) | |
349 '((&whole nil &rest | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2307
diff
changeset
|
350 ;; the following causes weird indentation |
257 | 351 ;;(&whole 1 1 2 nil) |
352 ) | |
353 (&whole nil &rest 1)) | |
354 path state indent-point sexp-column normal-indent))) | |
355 | |
356 (defun lisp-indent-function-lambda-hack (path state indent-point | |
357 sexp-column normal-indent) | |
358 ;; indent (function (lambda () <newline> <body-forms>)) kludgily. | |
359 (if (or (cdr path) ; wtf? | |
360 (> (car path) 3)) | |
361 ;; line up under previous body form | |
362 normal-indent | |
363 ;; line up under function rather than under lambda in order to | |
364 ;; conserve horizontal space. (Which is what #' is for.) | |
365 (condition-case () | |
366 (save-excursion | |
367 (backward-up-list 2) | |
368 (forward-char 1) | |
369 (if (looking-at "\\(lisp:+\\)?function\\(\\Sw\\|\\S_\\)") | |
370 (+ lisp-body-indent -1 (current-column)) | |
371 (+ sexp-column lisp-body-indent))) | |
372 (error (+ sexp-column lisp-body-indent))))) | |
373 | |
374 | |
375 (let ((l '((block 1) | |
376 (catch 1) | |
20954 | 377 (case (4 &rest (&whole 2 &rest 1))) |
378 (ccase . case) (ecase . case) | |
379 (typecase . case) (etypecase . case) (ctypecase . case) | |
380 (catch 1) | |
381 (cond (&rest (&whole 2 &rest 1))) | |
382 (block 1) | |
383 (defvar (4 2 2)) | |
21102 | 384 (defconstant . defvar) |
385 (defparameter . defvar) | |
20954 | 386 (define-modify-macro |
257 | 387 (4 &body)) |
20954 | 388 (define-setf-method |
389 (4 (&whole 4 &rest 1) &body)) | |
390 (defsetf (4 (&whole 4 &rest 1) 4 &body)) | |
391 (defun (4 (&whole 4 &rest 1) &body)) | |
392 (defmacro . defun) (deftype . defun) | |
21750
e152a39f074f
Indent defpackage correctly.
Richard M. Stallman <rms@gnu.org>
parents:
21102
diff
changeset
|
393 (defpackage (4 2)) |
20954 | 394 (defstruct ((&whole 4 &rest (&whole 2 &rest 1)) |
395 &rest (&whole 2 &rest 1))) | |
396 (destructuring-bind | |
397 ((&whole 6 &rest 1) 4 &body)) | |
398 (do lisp-indent-do) | |
399 (do* . do) | |
400 (dolist ((&whole 4 2 1) &body)) | |
401 (dotimes . dolist) | |
402 (eval-when 1) | |
403 (flet ((&whole 4 &rest (&whole 1 (&whole 4 &rest 1) &body)) | |
404 &body)) | |
405 (labels . flet) | |
406 (macrolet . flet) | |
407 ;; `else-body' style | |
408 (if (nil nil &body)) | |
409 ;; single-else style (then and else equally indented) | |
410 (if (&rest nil)) | |
21102 | 411 ;; (lambda ((&whole 4 &rest 1) &body)) |
20954 | 412 (lambda ((&whole 4 &rest 1) |
413 &rest lisp-indent-function-lambda-hack)) | |
414 (let ((&whole 4 &rest (&whole 1 1 2)) &body)) | |
415 (let* . let) | |
416 (compiler-let . let) ;barf | |
417 (locally 1) | |
418 ;(loop ...) | |
21102 | 419 (multiple-value-bind |
420 ((&whole 6 &rest 1) 4 &body)) | |
421 (multiple-value-call | |
422 (4 &body)) | |
20954 | 423 (multiple-value-prog1 1) |
21102 | 424 (multiple-value-setq |
425 (4 2)) | |
20954 | 426 (multiple-value-setf . multiple-value-setq) |
427 ;; Combines the worst features of BLOCK, LET and TAGBODY | |
428 (prog ((&whole 4 &rest 1) &rest lisp-indent-tagbody)) | |
429 (prog* . prog) | |
430 (prog1 1) | |
431 (prog2 2) | |
432 (progn 0) | |
433 (progv (4 4 &body)) | |
434 (return 0) | |
435 (return-from (nil &body)) | |
436 (tagbody lisp-indent-tagbody) | |
437 (throw 1) | |
438 (unless 1) | |
439 (unwind-protect (5 &body)) | |
22180
485917486caf
Indent `with-standard-io-syntax' correctly.
Richard M. Stallman <rms@gnu.org>
parents:
21750
diff
changeset
|
440 (when 1) |
485917486caf
Indent `with-standard-io-syntax' correctly.
Richard M. Stallman <rms@gnu.org>
parents:
21750
diff
changeset
|
441 (with-standard-io-syntax (2))))) |
257 | 442 (while l |
443 (put (car (car l)) 'common-lisp-indent-function | |
20954 | 444 (if (symbolp (cdr (car l))) |
445 (get (cdr (car l)) 'common-lisp-indent-function) | |
446 (car (cdr (car l))))) | |
257 | 447 (setq l (cdr l)))) |
448 | |
449 | |
450 ;(defun foo (x) | |
451 ; (tagbody | |
452 ; foo | |
453 ; (bar) | |
454 ; baz | |
455 ; (when (losing) | |
456 ; (with-big-loser | |
457 ; (yow) | |
458 ; ((lambda () | |
459 ; foo) | |
460 ; big))) | |
461 ; (flet ((foo (bar baz zap) | |
462 ; (zip)) | |
463 ; (zot () | |
464 ; quux)) | |
465 ; (do () | |
466 ; ((lose) | |
467 ; (foo 1)) | |
468 ; (quux) | |
469 ; foo | |
470 ; (lose)) | |
471 ; (cond ((x) | |
472 ; (win 1 2 | |
473 ; (foo))) | |
474 ; (t | |
475 ; (lose | |
476 ; 3)))))) | |
477 | |
478 | |
479 ;(put 'while 'common-lisp-indent-function 1) | |
480 ;(put 'defwrapper'common-lisp-indent-function ...) | |
481 ;(put 'def 'common-lisp-indent-function ...) | |
482 ;(put 'defflavor 'common-lisp-indent-function ...) | |
483 ;(put 'defsubst 'common-lisp-indent-function ...) | |
484 | |
485 ;(put 'with-restart 'common-lisp-indent-function '((1 4 ((* 1))) (2 &body))) | |
486 ;(put 'restart-case 'common-lisp-indent-function '((1 4) (* 2 ((0 1) (* 1))))) | |
487 ;(put 'define-condition 'common-lisp-indent-function '((1 6) (2 6 ((* 1))) (3 4 ((* 1))) (4 &body))) | |
488 ;(put 'with-condition-handler 'common-lisp-indent-function '((1 4 ((* 1))) (2 &body))) | |
489 ;(put 'condition-case 'common-lisp-indent-function '((1 4) (* 2 ((0 1) (1 3) (2 &body))))) | |
490 | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
257
diff
changeset
|
491 ;;; cl-indent.el ends here |