diff options
| author | Noam Postavsky | 2017-03-05 00:53:58 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-03-12 20:08:32 -0400 |
| commit | cf670b49a7704d63575863f832426d32bf6a8c3c (patch) | |
| tree | 8c698967d3e93313d7dc830fed3d3880b566c27a | |
| parent | 3ee3995d105ff02f0fac540757431d36cb45c6c7 (diff) | |
| download | emacs-cf670b49a7704d63575863f832426d32bf6a8c3c.tar.gz emacs-cf670b49a7704d63575863f832426d32bf6a8c3c.zip | |
Fix indent-sexp when called from inside a string (Bug#21343)
* lisp/emacs-lisp/lisp-mode.el (indent-sexp): Get initial syntax parse
state from `syntax-ppss'.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 5faa6a50ae5..eb07c18b03d 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -1075,10 +1075,14 @@ ENDPOS is encountered." | |||
| 1075 | ;; since every line we indent is more deeply nested than point is. | 1075 | ;; since every line we indent is more deeply nested than point is. |
| 1076 | (starting-point (save-excursion (if endpos (beginning-of-defun)) | 1076 | (starting-point (save-excursion (if endpos (beginning-of-defun)) |
| 1077 | (point))) | 1077 | (point))) |
| 1078 | (state nil) | 1078 | ;; Use `syntax-ppss' to get initial state so we don't get |
| 1079 | (init-depth 0) | 1079 | ;; confused by starting inside a string. We don't use |
| 1080 | (next-depth 0) | 1080 | ;; `syntax-ppss' in the loop, because this is measurably |
| 1081 | (last-depth 0) | 1081 | ;; slower when we're called on a long list. |
| 1082 | (state (syntax-ppss)) | ||
| 1083 | (init-depth (car state)) | ||
| 1084 | (next-depth init-depth) | ||
| 1085 | (last-depth init-depth) | ||
| 1082 | (last-syntax-point (point))) | 1086 | (last-syntax-point (point))) |
| 1083 | (unless endpos | 1087 | (unless endpos |
| 1084 | ;; Get error now if we don't have a complete sexp after point. | 1088 | ;; Get error now if we don't have a complete sexp after point. |