[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ca9fb10 2/2: lisp/emacs-lisp/lisp-mode.el: Fix parser state corru
From: |
Lars Ingebrigtsen |
Subject: |
master ca9fb10 2/2: lisp/emacs-lisp/lisp-mode.el: Fix parser state corruption. |
Date: |
Mon, 8 Nov 2021 01:38:48 -0500 (EST) |
branch: master
commit ca9fb109f75565dce7ba527f273cebc16887287e
Author: akater <nuclearspace@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
lisp/emacs-lisp/lisp-mode.el: Fix parser state corruption.
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p): Preserve
the point.
* test/lisp/progmodes/elisp-mode-resources/flet.erts: Add corresponding
test example (bug#9622).
---
lisp/emacs-lisp/lisp-mode.el | 13 +++++++------
test/lisp/progmodes/elisp-mode-resources/flet.erts | 10 ++++++++++
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 15afdef..a5613e7 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1148,12 +1148,13 @@ STATE is the `parse-partial-sexp' state for current
position."
;; that starts a sexp.
t)
(point))))))
- (ignore-errors
- ;; We rely on `backward-up-list' working
- ;; even when sexp is incomplete “to the right”.
- (backward-up-list 2)
- t)
- (= local-definitions-starting-point (point))))))))
+ (save-excursion
+ (ignore-errors
+ ;; We rely on `backward-up-list' working
+ ;; even when sexp is incomplete “to the right”.
+ (backward-up-list 2)
+ t)
+ (= local-definitions-starting-point (point)))))))))
(defun lisp-indent-function (indent-point state)
"This function is the normal value of the variable `lisp-indent-function'.
diff --git a/test/lisp/progmodes/elisp-mode-resources/flet.erts
b/test/lisp/progmodes/elisp-mode-resources/flet.erts
index 7c4a0f3..da3dcb6 100644
--- a/test/lisp/progmodes/elisp-mode-resources/flet.erts
+++ b/test/lisp/progmodes/elisp-mode-resources/flet.erts
@@ -221,6 +221,16 @@ Name: flet15
i)))
=-=-=
+Name: flet16
+
+=-=
+(cl-flet ((f (x)
+ (g x)))
+ (pcase e
+ ((dangerous-expression)
+ (form))))
+=-=-=
+
Name: flet-indentation-incomplete-sexp-no-side-effects-1
Code: (lambda () (emacs-lisp-mode) (setq indent-tabs-mode nil) (newline nil t))
Point-Char: |