1 ;;; cl-indent.el --- enhanced lisp-indent mode
3 ;; Copyright (C) 1987, 2000-2015 Free Software Foundation, Inc.
5 ;; Author: Richard Mlynarik <mly@eddie.mit.edu>
7 ;; Maintainer: emacs-devel@gnu.org
8 ;; Keywords: lisp, tools
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 ;; This package supplies a single entry point, common-lisp-indent-function,
29 ;; which performs indentation in the preferred style for Common Lisp code.
30 ;; It is also a suitable function for indenting Emacs lisp code.
34 ;; (setq lisp-indent-function 'common-lisp-indent-function)
38 (eval-when-compile (require 'cl
))
40 (defgroup lisp-indent nil
41 "Indentation in Lisp."
45 (defcustom lisp-indent-maximum-backtracking
3
46 "Maximum depth to backtrack out from a sublist for structured indentation.
47 If this variable is 0, no backtracking will occur and forms such as `flet'
48 may not be correctly indented."
52 (defcustom lisp-tag-indentation
1
53 "Indentation of tags relative to containing list.
54 This variable is used by the function `lisp-indent-tagbody'."
58 (defcustom lisp-tag-body-indentation
3
59 "Indentation of non-tagged lines relative to containing list.
60 This variable is used by the function `lisp-indent-tagbody' to indent normal
61 lines (lines without tags).
62 The indentation is relative to the indentation of the parenthesis enclosing
63 the special form. If the value is t, the body of tags will be indented
64 as a block at the same indentation as the first s-expression following
65 the tag. In this case, any forms before the first tag are indented
66 by `lisp-body-indent'."
70 (defcustom lisp-backquote-indentation t
71 "Whether or not to indent backquoted lists as code.
72 If nil, indent backquoted lists as data, i.e., like quoted lists."
77 (defcustom lisp-loop-keyword-indentation
3
78 "Indentation of loop keywords in extended loop forms."
83 (defcustom lisp-loop-forms-indentation
5
84 "Indentation of forms in extended loop forms."
89 (defcustom lisp-simple-loop-indentation
3
90 "Indentation of forms in simple loop forms."
94 (defcustom lisp-lambda-list-keyword-alignment nil
95 "Whether to vertically align lambda-list keywords together.
96 If nil (the default), keyworded lambda-list parts are aligned
97 with the initial mandatory arguments, like this:
99 \(defun foo (arg1 arg2 &rest rest
103 If non-nil, alignment is done with the first keyword
104 \(or falls back to the previous case), as in:
106 \(defun foo (arg1 arg2 &rest rest
113 (defcustom lisp-lambda-list-keyword-parameter-indentation
2
114 "Indentation of lambda list keyword parameters.
115 See `lisp-lambda-list-keyword-parameter-alignment'
116 for more information."
121 (defcustom lisp-lambda-list-keyword-parameter-alignment nil
122 "Whether to vertically align lambda-list keyword parameters together.
123 If nil (the default), the parameters are aligned
124 with their corresponding keyword, plus the value of
125 `lisp-lambda-list-keyword-parameter-indentation', like this:
127 \(defun foo (arg1 arg2 &key key1 key2
131 If non-nil, alignment is done with the first parameter
132 \(or falls back to the previous case), as in:
134 \(defun foo (arg1 arg2 &key key1 key2
141 (defcustom lisp-indent-backquote-substitution-mode t
142 "How to indent substitutions in backquotes.
143 If `t', the default, indent substituted forms normally.
144 If `nil', do not apply special indentation rule to substituted
145 forms. If `corrected', subtract the `,' or `,@' from the form
146 column, indenting as if this character sequence were not present.
147 In any case, do not backtrack beyond a backquote substitution.
149 Until Emacs 25.1, the `nil' behavior was hard-wired."
151 :type
'(choice (const corrected
) (const nil
) (const t
))
155 (defvar lisp-indent-defun-method
'(4 &lambda
&body
)
156 "Defun-like indentation method.
157 This applies when the value of the `common-lisp-indent-function' property
161 (defun lisp-extended-loop-p (loop-start)
162 "True if an extended loop form starts at LOOP-START."
165 (goto-char loop-start
)
172 (defun lisp-indent-find-method (symbol &optional no-compat
)
173 "Find the lisp indentation function for SYMBOL.
174 If NO-COMPAT is non-nil, do not retrieve indenters intended for
175 the standard lisp indent package."
176 (or (and (derived-mode-p 'emacs-lisp-mode
)
177 (get symbol
'common-lisp-indent-function-for-elisp
))
178 (get symbol
'common-lisp-indent-function
)
180 (get symbol
'lisp-indent-function
))))
182 (defun common-lisp-loop-part-indentation (indent-point state
)
183 "Compute the indentation of loop form constituents."
184 (let* ((loop-indentation (save-excursion
185 (goto-char (elt state
1))
187 (when (and (eq lisp-indent-backquote-substitution-mode
'corrected
))
189 (goto-char (elt state
1))
190 (incf loop-indentation
191 (cond ((eq (char-before) ?
,) -
1)
192 ((and (eq (char-before) ?
@)
193 (progn (backward-char)
194 (eq (char-before) ?
,)))
198 (goto-char indent-point
)
201 (cond ((not (lisp-extended-loop-p (elt state
1)))
202 (+ loop-indentation lisp-simple-loop-indentation
))
203 ((looking-at "^\\s-*\\(:?\\sw+\\|;\\)")
204 (+ loop-indentation lisp-loop-keyword-indentation
))
206 (+ loop-indentation lisp-loop-forms-indentation
)))
207 ;; Tell the caller that the next line needs recomputation, even
208 ;; though it doesn't start a sexp.
212 ;; Cf (info "(elisp)Specification List")
214 (defun common-lisp-indent-function (indent-point state
)
215 "Function to indent the arguments of a Lisp function call.
216 This is suitable for use as the value of the variable
217 `lisp-indent-function'. INDENT-POINT is the point at which the
218 indentation function is called, and STATE is the
219 `parse-partial-sexp' state at that position. Browse the
220 `lisp-indent' customize group for options affecting the behavior
223 If the indentation point is in a call to a Lisp function, that
224 function's `common-lisp-indent-function' property specifies how
225 this function should indent it. Possible values for this
228 * defun, meaning indent according to `lisp-indent-defun-method';
229 i.e., like (4 &lambda &body), as explained below.
231 * any other symbol, meaning a function to call. The function should
232 take the arguments: PATH STATE INDENT-POINT SEXP-COLUMN NORMAL-INDENT.
233 PATH is a list of integers describing the position of point in terms of
234 list-structure with respect to the containing lists. For example, in
235 ((a b c (d foo) f) g), foo has a path of (0 3 1). In other words,
236 to reach foo take the 0th element of the outermost list, then
237 the 3rd element of the next list, and finally the 1st element.
238 STATE and INDENT-POINT are as in the arguments to
239 `common-lisp-indent-function'. SEXP-COLUMN is the column of
240 the open parenthesis of the innermost containing list.
241 NORMAL-INDENT is the column the indentation point was
242 originally in. This function should behave like `lisp-indent-259'.
244 * an integer N, meaning indent the first N arguments like
245 function arguments, and any further arguments like a body.
246 This is equivalent to (4 4 ... &body).
248 * a list. The list element in position M specifies how to indent the Mth
249 function argument. If there are fewer elements than function arguments,
250 the last list element applies to all remaining arguments. The accepted
253 * nil, meaning the default indentation.
255 * an integer, specifying an explicit indentation.
257 * &lambda. Indent the argument (which may be a list) by 4.
259 * &rest. When used, this must be the penultimate element. The
260 element after this one applies to all remaining arguments.
262 * &body. This is equivalent to &rest lisp-body-indent, i.e., indent
263 all remaining elements by `lisp-body-indent'.
265 * &whole. This must be followed by nil, an integer, or a
266 function symbol. This indentation is applied to the
267 associated argument, and as a base indent for all remaining
268 arguments. For example, an integer P means indent this
269 argument by P, and all remaining arguments by P, plus the
270 value specified by their associated list element.
272 * a symbol. A function to call, with the 6 arguments specified above.
274 * a list, with elements as described above. This applies when the
275 associated function argument is itself a list. Each element of the list
276 specifies how to indent the associated argument.
278 For example, the function `case' has an indent property
279 \(4 &rest (&whole 2 &rest 1)), meaning:
280 * indent the first argument by 4.
281 * arguments after the first should be lists, and there may be any number
282 of them. The first list element has an offset of 2, all the rest
283 have an offset of 2+1=3.
285 If the current mode is actually `emacs-lisp-mode', look for a
286 `common-lisp-indent-function-for-elisp' property before looking
287 at `common-lisp-indent-function' and, if set, use its value
289 ;; FIXME: why do we need to special-case loop?
290 (if (save-excursion (goto-char (elt state
1))
291 (and (looking-at (if (derived-mode-p 'emacs-lisp-mode
)
293 "([Ll][Oo][Oo][Pp]"))
294 (or lisp-indent-backquote-substitution-mode
296 (or (and (eq (char-before) ?
@)
297 (progn (backward-char)
298 (eq (char-before) ?
,)))
299 (eq (char-before) ?
,))))))
300 (common-lisp-loop-part-indentation indent-point state
)
301 (common-lisp-indent-function-1 indent-point state
)))
304 (defun common-lisp-indent-function-1 (indent-point state
)
305 (let ((normal-indent (current-column)))
306 ;; Walk up list levels until we see something
307 ;; which does special things with subforms.
309 ;; Path describes the position of point in terms of
310 ;; list-structure with respect to containing lists.
311 ;; `foo' has a path of (0 3 1) in `((a b c (d foo) f) g)'.
313 ;; set non-nil when somebody works out the indentation to use
315 ;; If non-nil, this is an indentation to use
316 ;; if nothing else specifies it more firmly.
318 (last-point indent-point
)
319 ;; the position of the open-paren of the innermost containing list
320 (containing-form-start (elt state
1))
321 ;; the column of the above
323 ;; Move to start of innermost containing list
324 (goto-char containing-form-start
)
325 (setq sexp-column
(current-column))
327 ;; Look over successively less-deep containing forms
328 (while (and (not calculated
)
329 (< depth lisp-indent-maximum-backtracking
))
330 (let ((containing-sexp (point)))
332 (parse-partial-sexp (point) indent-point
1 t
)
333 ;; Move to the car of the relevant containing form
334 (let (tem function method tentative-defun
)
335 (if (not (looking-at "\\sw\\|\\s_"))
336 ;; This form doesn't seem to start with a symbol
337 (setq function nil method nil
)
340 (setq function
(downcase (buffer-substring-no-properties
343 ;; Elisp generally provides CL functionality with a CL
344 ;; prefix, so if we have a special indenter for the
345 ;; unprefixed version, prefer it over whatever's defined
346 ;; for the cl- version. Users can override this
347 ;; heuristic by defining a
348 ;; common-lisp-indent-function-for-elisp property on the
350 (when (and (derived-mode-p 'emacs-lisp-mode
)
351 (not (lisp-indent-find-method
352 (intern-soft function
) t
))
353 (string-match "\\`cl-" function
)
354 (setf tem
(intern-soft
355 (substring function
(match-end 0))))
356 (lisp-indent-find-method tem t
))
357 (setf function
(symbol-name tem
)))
358 (setq tem
(intern-soft function
)
359 method
(lisp-indent-find-method tem
))
360 ;; The pleblisp package feature
361 (when (and (null tem
)
362 (string-match ":[^:]+" function
))
363 (setq function
(substring function
(1+ (match-beginning 0)))
364 tem
(intern-soft function
)
365 method
(lisp-indent-find-method tem
))))
367 ;; How far into the containing form is the current form?
368 (if (< (point) indent-point
)
369 (while (condition-case ()
372 (if (>= (point) indent-point
)
374 (parse-partial-sexp (point)
379 (setq path
(cons n path
)))
381 ;; backwards compatibility.
382 (cond ((null function
))
384 (when (null (cdr path
))
385 ;; (package prefix was stripped off above)
386 (cond ((string-match "\\`def"
388 (setq tentative-defun
t))
392 (regexp-opt '("with" "without" "do"))
395 (setq method
'(&lambda
&body
))))))
396 ;; backwards compatibility. Bletch.
398 (setq method lisp-indent-defun-method
)))
400 (cond ((and (or (eq (char-after (1- containing-sexp
)) ?
\')
401 (and (not lisp-backquote-indentation
)
402 (eq (char-after (1- containing-sexp
)) ?\
`)))
403 (not (eq (char-after (- containing-sexp
2)) ?\
#)))
404 ;; No indentation for "'(...)" elements
405 (setq calculated
(1+ sexp-column
)))
407 (or (eq (char-after (1- containing-sexp
)) ?\
,)
408 (and (eq (char-after (1- containing-sexp
)) ?\
@)
409 (eq (char-after (- containing-sexp
2)) ?\
,)))
410 ;; ",(...)" or ",@(...)"
411 (when (eq lisp-indent-backquote-substitution-mode
413 (incf sexp-column -
1)
414 (when (eq (char-after (1- containing-sexp
)) ?\
@)
415 (incf sexp-column -
1)))
416 (cond (lisp-indent-backquote-substitution-mode
417 (setf tentative-calculated normal-indent
)
418 (setq depth lisp-indent-maximum-backtracking
)
420 (t (setq calculated normal-indent
)))))
421 ((eq (char-after (1- containing-sexp
)) ?\
#)
423 (setq calculated
(1+ sexp-column
)))
425 ;; If this looks like a call to a `def...' form,
426 ;; think about indenting it as one, but do it
427 ;; tentatively for cases like
430 ;; Set both normal-indent and tentative-calculated.
431 ;; The latter ensures this value gets used
432 ;; if there are no relevant containing constructs.
433 ;; The former ensures this value gets used
434 ;; if there is a relevant containing construct
435 ;; but we are nested within the structure levels
436 ;; that it specifies indentation for.
438 (setq tentative-calculated
439 (common-lisp-indent-call-method
440 function lisp-indent-defun-method
441 path state indent-point
442 sexp-column normal-indent
)
443 normal-indent tentative-calculated
)))
445 ;; convenient top-level hack.
446 ;; (also compatible with lisp-indent-function)
447 ;; The number specifies how many `distinguished'
448 ;; forms there are before the body starts
449 ;; Equivalent to (4 4 ... &body)
450 (setq calculated
(cond ((cdr path
)
452 ((<= (car path
) method
)
453 ;; `distinguished' form
454 (list (+ sexp-column
4)
455 containing-form-start
))
456 ((= (car path
) (1+ method
))
458 (+ sexp-column lisp-body-indent
))
464 (common-lisp-indent-call-method
465 function method path state indent-point
466 sexp-column normal-indent
)))))
467 (goto-char containing-sexp
)
468 (setq last-point containing-sexp
)
471 (progn (backward-up-list 1)
472 (setq depth
(1+ depth
)))
473 (error (setq depth lisp-indent-maximum-backtracking
))))))
474 (or calculated tentative-calculated
))))
477 (defun common-lisp-indent-call-method (function method path state indent-point
478 sexp-column normal-indent
)
479 (let ((lisp-indent-error-function function
))
482 path state indent-point
483 sexp-column normal-indent
)
484 (lisp-indent-259 method path state indent-point
485 sexp-column normal-indent
))))
487 ;; Dynamically bound in common-lisp-indent-call-method.
488 (defvar lisp-indent-error-function
)
490 (defun lisp-indent-report-bad-format (m)
491 (error "%s has a badly-formed %s property: %s"
492 ;; Love those free variable references!!
493 lisp-indent-error-function
'common-lisp-indent-function m
))
496 ;; Lambda-list indentation is now done in LISP-INDENT-LAMBDA-LIST.
497 ;; See also `lisp-lambda-list-keyword-alignment',
498 ;; `lisp-lambda-list-keyword-parameter-alignment' and
499 ;; `lisp-lambda-list-keyword-parameter-indentation' -- dvl
501 (defvar lisp-indent-lambda-list-keywords-regexp
503 optional\\|rest\\|key\\|allow-other-keys\\|aux\\|whole\\|body\\|environment\
505 "Regular expression matching lambda-list keywords.")
507 (defun lisp-indent-lambda-list
508 (indent-point sexp-column containing-form-start
)
510 (cond ((save-excursion
511 (goto-char indent-point
)
513 (skip-chars-forward " \t")
515 (looking-at lisp-indent-lambda-list-keywords-regexp
))
516 ;; We're facing a lambda-list keyword.
517 (if lisp-lambda-list-keyword-alignment
518 ;; Align to the first keyword if any, or to the beginning of
521 (goto-char containing-form-start
)
523 (if (re-search-forward
524 lisp-indent-lambda-list-keywords-regexp
527 (goto-char (match-beginning 0))
530 ;; Align to the beginning of the lambda-list.
533 ;; Otherwise, align to the first argument of the last lambda-list
534 ;; keyword, the keyword itself, or the beginning of the
537 (goto-char indent-point
)
541 (if (re-search-backward lisp-indent-lambda-list-keywords-regexp
542 containing-form-start t
)
545 (goto-char (match-beginning 0))
547 (indented-keyword-posn
549 lisp-lambda-list-keyword-parameter-indentation
)))
550 (goto-char (match-end 0))
551 (skip-chars-forward " \t")
553 indented-keyword-posn
554 (if lisp-lambda-list-keyword-parameter-alignment
556 indented-keyword-posn
)))
557 (1+ sexp-column
))))))))
559 ;; Blame the crufty control structure on dynamic scoping
561 (defun lisp-indent-259
562 (method path state indent-point sexp-column normal-indent
)
565 (containing-form-start (elt state
1))
567 ;; Isn't tail-recursion wonderful?
569 ;; This while loop is for destructuring.
570 ;; p is set to (cdr p) each iteration.
571 (if (not (consp method
)) (lisp-indent-report-bad-format method
))
576 ;; This while loop is for advancing along a method
577 ;; until the relevant (possibly &rest/&body) pattern
579 ;; n is set to (1- n) and method to (cdr method)
581 (setq tem
(car method
))
583 (or (eq tem
'nil
) ;default indentation
584 (eq tem
'&lambda
) ;lambda list
585 (and (eq tem
'&body
) (null (cdr method
)))
588 (null (cddr method
)))
589 (integerp tem
) ;explicit indentation specified
590 (and (consp tem
) ;destructuring
591 (eq (car tem
) '&whole
)
592 (or (symbolp (cadr tem
))
593 (integerp (cadr tem
))))
594 (and (symbolp tem
) ;a function to call to do the work.
596 (lisp-indent-report-bad-format method
))
598 (cond ((and tail
(not (consp tem
)))
599 ;; indent tail of &rest in same way as first elt of rest
600 (throw 'exit normal-indent
))
602 ;; &body means (&rest <lisp-body-indent>)
604 (if (and (= n
0) ;first body form
605 (null p
)) ;not in subforms
610 ;; this pattern holds for all remaining forms
613 method
(cdr method
)))
615 ;; try next element of pattern
619 ;; Too few elements in pattern.
620 (throw 'exit normal-indent
)))
622 (throw 'exit
(if (consp normal-indent
)
624 (list normal-indent containing-form-start
))))
628 (list (+ sexp-column
4) containing-form-start
))
630 ;; Indentation within a lambda-list. -- dvl
631 (list (lisp-indent-lambda-list
634 containing-form-start
)
635 containing-form-start
))
640 (if (null p
) ;not in subforms
641 (list (+ sexp-column tem
) containing-form-start
)
643 ((symbolp tem
) ;a function to call
645 (funcall tem path state indent-point
646 sexp-column normal-indent
)))
648 ;; must be a destructing frob
651 (setq method
(cddr tem
)
653 (setq tem
(cadr tem
))
659 containing-form-start
))
661 (list (+ sexp-column tem
)
662 containing-form-start
))
664 (funcall tem path state indent-point
665 sexp-column normal-indent
))))))))))))
667 (defun lisp-indent-tagbody (path state indent-point sexp-column normal-indent
)
668 (if (not (null (cdr path
)))
671 (goto-char indent-point
)
673 (skip-chars-forward " \t")
674 (list (cond ((looking-at "\\sw\\|\\s_")
676 (+ sexp-column lisp-tag-indentation
))
677 ((integerp lisp-tag-body-indentation
)
678 (+ sexp-column lisp-tag-body-indentation
))
679 ((eq lisp-tag-body-indentation
't
)
681 (progn (backward-sexp 1) (current-column))
682 (error (1+ sexp-column
))))
683 (t (+ sexp-column lisp-body-indent
)))
684 ; (cond ((integerp lisp-tag-body-indentation)
685 ; (+ sexp-column lisp-tag-body-indentation))
686 ; ((eq lisp-tag-body-indentation 't)
689 ; (+ sexp-column lisp-body-indent)))
693 (defun lisp-indent-do (path state indent-point sexp-column normal-indent
)
694 (if (>= (car path
) 3)
695 (let ((lisp-tag-body-indentation lisp-body-indent
))
696 (funcall (function lisp-indent-tagbody
)
697 path state indent-point sexp-column normal-indent
))
698 (funcall (function lisp-indent-259
)
700 ;; the following causes weird indentation
703 (&whole nil
&rest
1))
704 path state indent-point sexp-column normal-indent
)))
707 ;; LISP-INDENT-DEFMETHOD now supports the presence of more than one method
708 ;; qualifier and indents the method's lambda list properly. -- dvl
709 (defun lisp-indent-defmethod
710 (path state indent-point sexp-column normal-indent
)
713 (if (and (>= (car path
) 3)
718 (skip-chars-forward " \t\n")
719 (while (looking-at "\\sw\\|\\s_")
722 (skip-chars-forward " \t\n"))
724 (append '(4) (make-list nqual
4) '(&lambda
&body
))
725 (get 'defun
'common-lisp-indent-function
)))
726 path state indent-point sexp-column normal-indent
))
729 (defun lisp-indent-function-lambda-hack (path state indent-point
730 sexp-column normal-indent
)
731 ;; indent (function (lambda () <newline> <body-forms>)) kludgily.
732 (if (or (cdr path
) ; wtf?
734 ;; line up under previous body form
736 ;; line up under function rather than under lambda in order to
737 ;; conserve horizontal space. (Which is what #' is for.)
742 (if (looking-at "\\(lisp:+\\)?function\\(\\Sw\\|\\S_\\)")
743 (+ lisp-body-indent -
1 (current-column))
744 (+ sexp-column lisp-body-indent
)))
745 (error (+ sexp-column lisp-body-indent
)))))
750 (case (4 &rest
(&whole
2 &rest
1)))
757 (cond (&rest
(&whole
2 &rest
1)))
759 (defclass (6 4 (&whole
2 &rest
1) (&whole
2 &rest
1)))
760 (defconstant . defvar
)
761 (defcustom (4 2 2 2))
762 (defparameter . defvar
)
763 (defconst . defcustom
)
764 (define-condition . defclass
)
765 (define-modify-macro (4 &lambda
&body
))
766 (defsetf (4 &lambda
4 &body
))
767 (defun (4 &lambda
&body
))
768 (defgeneric (4 &lambda
&body
))
769 (define-setf-method . defun
)
770 (define-setf-expander . defun
)
774 (defmethod lisp-indent-defmethod)
776 (defstruct ((&whole
4 &rest
(&whole
2 &rest
1))
777 &rest
(&whole
2 &rest
1)))
779 ((&whole
6 &rest
1) 4 &body
))
782 (dolist ((&whole
4 2 1) &body
))
785 (flet ((&whole
4 &rest
(&whole
1 &lambda
&body
)) &body
))
788 (generic-flet . flet
)
789 (generic-labels . flet
)
790 (handler-case (4 &rest
(&whole
2 &lambda
&body
)))
791 (restart-case . handler-case
)
794 ;; single-else style (then and else equally indented)
796 (lambda (&lambda
&rest lisp-indent-function-lambda-hack
))
797 (let ((&whole
4 &rest
(&whole
1 1 2)) &body
))
799 (compiler-let . let
) ;barf
803 ;(loop lisp-indent-loop)
804 (:method
(&lambda
&body
)) ; in `defgeneric'
805 (multiple-value-bind ((&whole
6 &rest
1) 4 &body
))
806 (multiple-value-call (4 &body
))
807 (multiple-value-prog1 1)
808 (multiple-value-setq (4 2))
809 (multiple-value-setf . multiple-value-setq
)
810 (pprint-logical-block (4 2))
811 (print-unreadable-object ((&whole
4 1 &rest
1) &body
))
812 ;; Combines the worst features of BLOCK, LET and TAGBODY
813 (prog (&lambda
&rest lisp-indent-tagbody
))
820 (return-from (nil &body
))
821 (symbol-macrolet . let
)
822 (tagbody lisp-indent-tagbody
)
825 (unwind-protect (5 &body
))
827 (with-accessors . multiple-value-bind
)
828 (with-condition-restarts . multiple-value-bind
)
829 (with-compilation-unit (&lambda
&body
))
830 (with-output-to-string (4 2))
831 (with-slots . multiple-value-bind
)
832 (with-standard-io-syntax (2)))))
834 (put (car el
) 'common-lisp-indent-function
835 (if (symbolp (cdr el
))
836 (get (cdr el
) 'common-lisp-indent-function
)
839 ;; In elisp, the else part of `if' is in an implicit progn, so indent
841 (put 'if
'common-lisp-indent-function-for-elisp
2)
855 ; (flet ((foo (bar baz zap)
873 ;(put 'while 'common-lisp-indent-function 1)
874 ;(put 'defwrapper'common-lisp-indent-function ...)
875 ;(put 'def 'common-lisp-indent-function ...)
876 ;(put 'defflavor 'common-lisp-indent-function ...)
877 ;(put 'defsubst 'common-lisp-indent-function ...)
879 ;(put 'with-restart 'common-lisp-indent-function '((1 4 ((* 1))) (2 &body)))
880 ;(put 'restart-case 'common-lisp-indent-function '((1 4) (* 2 ((0 1) (* 1)))))
881 ;(put 'define-condition 'common-lisp-indent-function '((1 6) (2 6 ((&whole 1))) (3 4 ((&whole 1))) (4 &body)))
882 ;(put 'with-condition-handler 'common-lisp-indent-function '((1 4 ((* 1))) (2 &body)))
883 ;(put 'condition-case 'common-lisp-indent-function '((1 4) (* 2 ((0 1) (1 3) (2 &body)))))
884 ;(put 'defclass 'common-lisp-indent-function '((&whole 2 &rest (&whole 2 &rest 1) &rest (&whole 2 &rest 1)))
885 ;(put 'defgeneric 'common-lisp-indent-function 'defun)
889 ;;; cl-indent.el ends here