annotate lisp/emacs-lisp/cl-indent.el @ 28582:c5731a195ae1

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