Changeset 131
- Timestamp:
- 10/13/02 18:52:34 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/LispMode.java
r129 r131 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: LispMode.java,v 1. 3 2002-10-13 18:21:46piso Exp $5 * $Id: LispMode.java,v 1.4 2002-10-13 18:52:34 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 116 116 public int getCorrectIndentation(Line line, Buffer buffer) 117 117 { 118 Position here = new Position(line, 0); 119 Position start = findStartOfDefun(here); 118 int depth = depth(new Position(line, 0), buffer); 119 if (depth > 0) 120 return buffer.getIndentSize() * depth; 121 return 0; 122 } 123 124 private static int depth(Position pos, Buffer buffer) 125 { 126 if (buffer.needsRenumbering()) 127 buffer.renumber(); 128 Position start = findStartOfDefun(pos); 120 129 LispSyntaxIterator it = new LispSyntaxIterator(start); 121 130 int depth = 0; 122 while (it.getPosition().isBefore( here)) {131 while (it.getPosition().isBefore(pos)) { 123 132 char c = it.nextChar(); 124 133 if (c == '(') … … 127 136 --depth; 128 137 } 129 if (depth > 0) 130 return buffer.getIndentSize() * depth; 131 return 0; 138 return depth; 132 139 } 133 140 134 private Position findStartOfDefun(Position pos)141 private static Position findStartOfDefun(Position pos) 135 142 { 136 143 Line line = pos.getLine();
Note: See TracChangeset
for help on using the changeset viewer.