Commit 0acedfe
committed
Fix reader syntaxes distrupted by newlines
Lispy would assume an implicit nil after the reader syntax, like this:
```emacs-lisp
(defun foo ()
'
(bar baz)
) ;; point here, press i to format
```
Gets this incorrect result:
```emacs-lisp
(defun foo ()
'() (bar baz))
```
* lispy.el (lispy--delete-insignificant-sexps): allow removing sexps that are
implicitly-created by lispy, and serve no purpose in the real input and output
sexp other than formatting. At the moment, just remove newline nodes.
(lispy--read-reader-syntax): helper function to avoid code duplication; replaces
a reader syntax RS, e.g., "`", plus its immediately-next sexp into an internal
representation with TAG.
(lispy--read): update handling of "#'", ",@", "'", "`", "," to make use of
`lispy--read-reader-syntax'.
(lispy--insert): fixed float and quasiquote handling (currently it calls
`(insert (caddr sxp))', which is incorrect because `insert' considers it a
character; float was not problematic because this code path was never triggered:
things like 1.2 have not been converted into `ly-raw float' constructs anyway.
* lispy-test.el (lispy-read-quote-newline): added 5 simple tests for each of the
addressed reader syntaxes.1 parent 8175e9a commit 0acedfe
2 files changed
+64
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
184 | 201 | | |
185 | 202 | | |
186 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7286 | 7286 | | |
7287 | 7287 | | |
7288 | 7288 | | |
| 7289 | + | |
| 7290 | + | |
| 7291 | + | |
| 7292 | + | |
| 7293 | + | |
| 7294 | + | |
| 7295 | + | |
| 7296 | + | |
| 7297 | + | |
| 7298 | + | |
| 7299 | + | |
| 7300 | + | |
| 7301 | + | |
| 7302 | + | |
| 7303 | + | |
| 7304 | + | |
| 7305 | + | |
| 7306 | + | |
| 7307 | + | |
| 7308 | + | |
| 7309 | + | |
| 7310 | + | |
| 7311 | + | |
| 7312 | + | |
| 7313 | + | |
| 7314 | + | |
| 7315 | + | |
| 7316 | + | |
7289 | 7317 | | |
7290 | 7318 | | |
7291 | 7319 | | |
| |||
7416 | 7444 | | |
7417 | 7445 | | |
7418 | 7446 | | |
7419 | | - | |
7420 | | - | |
7421 | | - | |
7422 | | - | |
7423 | | - | |
7424 | | - | |
| 7447 | + | |
7425 | 7448 | | |
7426 | | - | |
7427 | | - | |
7428 | | - | |
7429 | | - | |
7430 | | - | |
7431 | | - | |
7432 | | - | |
7433 | | - | |
7434 | | - | |
7435 | | - | |
7436 | | - | |
7437 | | - | |
| 7449 | + | |
7438 | 7450 | | |
7439 | 7451 | | |
7440 | 7452 | | |
| |||
7457 | 7469 | | |
7458 | 7470 | | |
7459 | 7471 | | |
7460 | | - | |
7461 | | - | |
7462 | | - | |
7463 | | - | |
7464 | | - | |
7465 | | - | |
7466 | | - | |
7467 | | - | |
7468 | | - | |
7469 | | - | |
7470 | | - | |
7471 | | - | |
| 7472 | + | |
7472 | 7473 | | |
7473 | | - | |
7474 | | - | |
7475 | | - | |
7476 | | - | |
7477 | | - | |
7478 | | - | |
7479 | | - | |
7480 | | - | |
7481 | | - | |
7482 | | - | |
7483 | | - | |
7484 | | - | |
7485 | | - | |
7486 | | - | |
7487 | | - | |
7488 | | - | |
| 7474 | + | |
7489 | 7475 | | |
7490 | 7476 | | |
7491 | | - | |
7492 | | - | |
7493 | | - | |
7494 | | - | |
7495 | | - | |
7496 | | - | |
7497 | | - | |
7498 | | - | |
7499 | | - | |
7500 | | - | |
7501 | | - | |
7502 | | - | |
7503 | | - | |
7504 | | - | |
7505 | | - | |
7506 | | - | |
| 7477 | + | |
| 7478 | + | |
| 7479 | + | |
| 7480 | + | |
| 7481 | + | |
| 7482 | + | |
| 7483 | + | |
| 7484 | + | |
| 7485 | + | |
| 7486 | + | |
| 7487 | + | |
| 7488 | + | |
7507 | 7489 | | |
7508 | 7490 | | |
7509 | 7491 | | |
| |||
8128 | 8110 | | |
8129 | 8111 | | |
8130 | 8112 | | |
8131 | | - | |
| 8113 | + | |
8132 | 8114 | | |
8133 | 8115 | | |
8134 | 8116 | | |
| |||
8249 | 8231 | | |
8250 | 8232 | | |
8251 | 8233 | | |
8252 | | - | |
| 8234 | + | |
8253 | 8235 | | |
8254 | 8236 | | |
8255 | 8237 | | |
| |||
8260 | 8242 | | |
8261 | 8243 | | |
8262 | 8244 | | |
8263 | | - | |
| 8245 | + | |
8264 | 8246 | | |
8265 | 8247 | | |
8266 | 8248 | | |
| |||
0 commit comments