GNU bug report logs - #9622
23.3; flet indentation

Previous Next

Package: emacs;

Reported by: diogofsr <at> gmail.com (Diogo F. S. Ramos)

Date: Wed, 28 Sep 2011 01:59:02 UTC

Severity: minor

Tags: confirmed

Found in versions 23.3, 26.2

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #52 received at 9622 <at> debbugs.gnu.org (full text, mbox):

From: akater <nuclearspace <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, "Basil L. Contovounesios"
 <contovob <at> tcd.ie>
Cc: Mattias EngdegÄrd <mattiase <at> acm.org>, 9622 <at> debbugs.gnu.org,
 "Diogo F. S. Ramos" <diogofsr <at> gmail.com>
Subject: Re: bug#9622: [PATCH] Re: bug#9622: 23.3; flet indentation
Date: Thu, 30 Sep 2021 13:57:04 +0000
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Perhaps we should consider backing out these changed in Emacs 28 and
> continuing to work on them on the trunk?

I don't think so.  The first attempt was written in a hurry, and merged
without extensive testing; in the second I did exhaustive tests, it just
never crossed my mind to test on unbalanced expressions.  This very much
looks like the last ignore-errors of them:

[signature.asc (application/pgp-signature, inline)]
[0001-Fix-other-regressions-in-cl-flet-indentation.patch (text/x-diff, inline)]
From 2e5f87b345d349dc6657f8034102a842d0685232 Mon Sep 17 00:00:00 2001
From: akater <nuclearspace <at> gmail.com>
Date: Thu, 30 Sep 2021 13:37:59 +0000
Subject: [PATCH] Fix other regressions in cl-flet indentation

* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
Fix indentation regression
introduced by 38037e04cb05cb1f2b604f0b1602d36b0bcf6985
(bug#9622), namely don't fail in unreadable (incl. unbalanced) sexps.
---
 lisp/emacs-lisp/lisp-mode.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index cd054801bc..57196dfec4 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1124,9 +1124,13 @@ defun lisp--local-defform-body-p (state)
       (when second-order-parent
         (save-excursion
           (goto-char (1+ second-order-parent))
-          (and (memq (read (current-buffer))
-                     '( cl-flet cl-labels cl-macrolet cl-flet*
-                        cl-symbol-macrolet))
+          (and (when-let ((head (ignore-errors
+                                  ;; FIXME: This does not distinguish
+                                  ;; between reading nil and a read error.
+                                  ;; We don't care but still, better fix this.
+                                  (read (current-buffer)))))
+                 (memq head '( cl-flet cl-labels cl-macrolet cl-flet*
+                               cl-symbol-macrolet)))
                ;; Now we must check that we are
                ;; in the second element of the flet-like form.
                ;; It would be easier if `parse-partial-sexp' also recorded
-- 
2.32.0


This bug report was last modified 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.