From: akater <nuclearspace@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>, 9622@debbugs.gnu.org
Cc: "Mattias Engdegård" <mattiase@acm.org>,
"Lars Ingebrigtsen" <larsi@gnus.org>,
"Diogo F. S. Ramos" <diogofsr@gmail.com>
Subject: bug#9622: [PATCH] Re: bug#9622: 23.3; flet indentation
Date: Mon, 08 Nov 2021 06:18:11 +0000 [thread overview]
Message-ID: <875yt39nmk.fsf@gmail.com> (raw)
In-Reply-To: <878rxz8n6b.fsf_-_@web.de>
[-- Attachment #1.1: Type: text/plain, Size: 708 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
> #+begin_src emacs-lisp
> (cl-flet* ((cont-w/expr (f) (g-w/extended-expr cont f))
> (cont-prepend (&rest exps)
> (cont-w/expr (lambda (p) (apply #'g--and (append exps (list p)))))))
> (pcase expr
> ((and (let transformed (g--trivial-transformation-p expr)) (guard transformed))
> (cont-prepend transformed))))
> #+end_src
>
> and the last line gets indented wrongly (one space too less). When I
> remove the wrapping `cl-flet*' indentation behavior gets back to the
> expected.
Indeed, I forgot one save-excursion.
To Lars: tests involving complete sexps do pass, the rest I couldn't
run, as described in bug#51680
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 865 bytes --]
[-- Attachment #2: Fix flet indentation --]
[-- Type: text/x-diff, Size: 2399 bytes --]
From 367ec048e7fbf6d7f3453a64e953079575444f4d Mon Sep 17 00:00:00 2001
From: akater <nuclearspace@gmail.com>
Date: Mon, 8 Nov 2021 04:48:13 +0000
Subject: [PATCH] ; * 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
---
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 15afdef0252..a5613e70e0a 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1148,12 +1148,13 @@ defun lisp--local-defform-body-p (state)
;; 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 7c4a0f304e9..da3dcb6ec3e 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: |
--
2.32.0
next prev parent reply other threads:[~2021-11-08 6:18 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <504153FB-8633-4755-A91A-DF5DD64E6FAA@acm.org>
2021-09-28 3:01 ` bug#9622: 23.3; flet indentation akater
2021-09-28 5:23 ` Lars Ingebrigtsen
2021-09-28 10:11 ` Mattias Engdegård
2021-09-28 10:35 ` Mattias Engdegård
2021-09-28 16:39 ` akater
2021-09-29 18:12 ` bug#9622: [PATCH] " akater
2021-09-30 6:37 ` Lars Ingebrigtsen
2021-09-30 8:05 ` Mattias Engdegård
2021-09-30 13:06 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-30 13:41 ` Lars Ingebrigtsen
2021-09-30 13:57 ` akater
2021-10-01 11:27 ` Lars Ingebrigtsen
2021-10-09 7:26 ` akater
2021-10-09 11:23 ` Lars Ingebrigtsen
2021-10-28 19:23 ` akater
2021-10-28 21:53 ` Lars Ingebrigtsen
2021-09-30 14:52 ` Mattias Engdegård
2021-09-30 15:11 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-30 15:23 ` Thierry Volpiatto
2021-09-30 15:33 ` akater
2021-09-30 16:04 ` Thierry Volpiatto
2021-09-30 15:25 ` Mattias Engdegård
2021-09-30 15:56 ` akater
2021-09-30 19:28 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-30 23:23 ` akater
2021-11-08 1:13 ` Michael Heerdegen
2021-11-08 6:18 ` akater [this message]
2021-11-08 6:38 ` bug#9622: [PATCH] " Lars Ingebrigtsen
2021-11-08 6:38 ` akater
2021-11-08 6:53 ` Lars Ingebrigtsen
2021-11-08 9:36 ` akater
2021-11-09 3:25 ` Lars Ingebrigtsen
2021-11-08 16:30 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875yt39nmk.fsf@gmail.com \
--to=nuclearspace@gmail.com \
--cc=9622@debbugs.gnu.org \
--cc=diogofsr@gmail.com \
--cc=larsi@gnus.org \
--cc=mattiase@acm.org \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.