Commit a13e9dd
committed
userdiff: extend Scheme support for other Lisp dialects
Common Lisp, Emacs Lisp, and other dialects have some top-level forms,
most importantly 'defun', that are not matched by the current Scheme
pattern. Also, it is common in these dialects, when defining user
macros intended as top-level forms, to prefix their names with "def"
instead of "define"; such forms are also not currently matched. Some
such forms don't even begin with "def".
On the other hand, it is an established formatting convention in the
Lisp community that only top-level forms start at the left margin. So
matching any unindented line starting with an open parenthesis is an
acceptable heuristic; false positives will be rare.
However, there are also cases where notionally top-level forms are
grouped together within some containing form. At least in the Common
Lisp community, it is conventional to indent these by two spaces, or
sometimes one. But matching just an open parenthesis indented by two
spaces would be too broad; so the pattern added by this commit
requires an indented form to start with "(def". It is believed that
this strikes a good balance between potential false positives and
false negatives.
This commit disjoins a regexp employing these heuristics to the
existing Scheme regexp, so it will still match everything that it did
previously.1 parent da99bb0 commit a13e9dd
1 file changed
+12
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | 252 | | |
261 | 253 | | |
262 | 254 | | |
| |||
352 | 344 | | |
353 | 345 | | |
354 | 346 | | |
355 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
356 | 354 | | |
357 | | - | |
358 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
359 | 358 | | |
360 | | - | |
| 359 | + | |
361 | 360 | | |
362 | | - | |
| 361 | + | |
363 | 362 | | |
364 | 363 | | |
365 | 364 | | |
| |||
0 commit comments