diff options
| author | Noam Postavsky | 2018-07-27 19:41:39 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2018-07-27 19:41:39 -0400 |
| commit | 857910539313c0f2d89fe5626a41f1abe6c33ca7 (patch) | |
| tree | 7c4a9b8184cd09d842962fe9dcbec07651611766 /lisp | |
| parent | d24c5f26bf6c12bda614f90ba3345d710482005a (diff) | |
| download | emacs-857910539313c0f2d89fe5626a41f1abe6c33ca7.tar.gz emacs-857910539313c0f2d89fe5626a41f1abe6c33ca7.zip | |
Don't fail to indent-sexp before a full sexp (Bug#31984)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Only signal error if the
initial forward-sexp fails. Suppress scan-error forn any of the
forward-sexp calls after that.
* test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-cant-go): New
test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 44b27236a9c..205c810b978 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -1199,14 +1199,22 @@ ENDPOS is encountered." | |||
| 1199 | (setq endpos (copy-marker | 1199 | (setq endpos (copy-marker |
| 1200 | (if endpos endpos | 1200 | (if endpos endpos |
| 1201 | ;; Get error now if we don't have a complete sexp | 1201 | ;; Get error now if we don't have a complete sexp |
| 1202 | ;; after point. We actually look for a sexp which | 1202 | ;; after point. |
| 1203 | ;; ends after the current line so that we properly | 1203 | (save-excursion |
| 1204 | ;; indent things like #s(...). This might not be | 1204 | (let ((eol (line-end-position))) |
| 1205 | ;; needed if Bug#15998 is fixed. | 1205 | (forward-sexp 1) |
| 1206 | (let ((eol (line-end-position))) | 1206 | ;; We actually look for a sexp which ends |
| 1207 | (save-excursion (while (and (< (point) eol) (not (eobp))) | 1207 | ;; after the current line so that we properly |
| 1208 | (forward-sexp 1)) | 1208 | ;; indent things like #s(...). This might not |
| 1209 | (point)))))) | 1209 | ;; be needed if Bug#15998 is fixed. |
| 1210 | (condition-case () | ||
| 1211 | (while (and (< (point) eol) (not (eobp))) | ||
| 1212 | (forward-sexp 1)) | ||
| 1213 | ;; But don't signal an error for incomplete | ||
| 1214 | ;; sexps following the first complete sexp | ||
| 1215 | ;; after point. | ||
| 1216 | (scan-error nil))) | ||
| 1217 | (point))))) | ||
| 1210 | (save-excursion | 1218 | (save-excursion |
| 1211 | (while (let ((indent (lisp-indent-calc-next parse-state)) | 1219 | (while (let ((indent (lisp-indent-calc-next parse-state)) |
| 1212 | (ppss (lisp-indent-state-ppss parse-state))) | 1220 | (ppss (lisp-indent-state-ppss parse-state))) |