]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/emacs-lisp/lisp-mode.el: Fix parser state corruption.
authorakater <nuclearspace@gmail.com>
Mon, 8 Nov 2021 06:37:51 +0000 (07:37 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 8 Nov 2021 06:38:41 +0000 (07:38 +0100)
* 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
test/lisp/progmodes/elisp-mode-resources/flet.erts

index 15afdef0252044e0b817da1ec1927d46adfed052..a5613e70e0ab13e585542e1c1139f6cafe712676 100644 (file)
@@ -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'.
index 7c4a0f304e968115efec5df703379b97309d146d..da3dcb6ec3e48342990b91a90523ae2bb70d84c0 100644 (file)
@@ -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: |