diff options
Diffstat (limited to 'lisp/emacs-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 25b61a23a94..6313c63ecfe 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1195,14 +1195,22 @@ ENDPOS is encountered." (setq endpos (copy-marker (if endpos endpos ;; Get error now if we don't have a complete sexp - ;; after point. We actually look for a sexp which - ;; ends after the current line so that we properly - ;; indent things like #s(...). This might not be - ;; needed if Bug#15998 is fixed. - (let ((eol (line-end-position))) - (save-excursion (while (and (< (point) eol) (not (eobp))) - (forward-sexp 1)) - (point)))))) + ;; after point. + (save-excursion + (let ((eol (line-end-position))) + (forward-sexp 1) + ;; We actually look for a sexp which ends + ;; after the current line so that we properly + ;; indent things like #s(...). This might not + ;; be needed if Bug#15998 is fixed. + (condition-case () + (while (and (< (point) eol) (not (eobp))) + (forward-sexp 1)) + ;; But don't signal an error for incomplete + ;; sexps following the first complete sexp + ;; after point. + (scan-error nil))) + (point))))) (save-excursion (while (let ((indent (lisp-indent-calc-next parse-state)) (ppss (lisp-indent-state-ppss parse-state))) |