Subject: bug#2160: 23.0.60; Indentation of LOOP (cl-indent.el)

From: Stefan Kangas <[email-masked]>
Date: Thu, 30 Apr 2020 18:19:38 +0200

Stefan Kangas <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> The former looks like what I'd expect (as a Common Lisp programmer).
>> Except that I would never ever do a newline after "(loop ".
>
> OK, thanks.  Let's push to master then.

Please find attached the patch I suggest.  I'll allow a couple of days
before I push it in case anyone has any comments.

Best regards,
Stefan Kangas

>From e8d3cb1601e9b83e743090f493befae103745fc9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Thu, 30 Apr 2020 18:11:28 +0200
Subject: [PATCH] Improve indentation of 'loop' forms

* lisp/emacs-lisp/cl-indent.el (lisp-loop-keyword-indentation)
(lisp-loop-forms-indentation, lisp-simple-loop-indentation): Use a
more standard indentation of 'loop' forms.  (Bug#2160)

(lisp-indent-maximum-backtracking, lisp-tag-indentation)
(lisp-tag-body-indentation, lisp-backquote-indentation)
(lisp-loop-keyword-indentation, lisp-loop-forms-indentation)
(lisp-simple-loop-indentation): Remove redundant :group args.
---
 lisp/emacs-lisp/cl-indent.el | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index fd8715962a..361414ef1f 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -46,14 +46,12 @@ lisp-indent-maximum-backtracking
   "Maximum depth to backtrack out from a sublist for structured indentation.
 If this variable is 0, no backtracking will occur and forms such as `flet'
 may not be correctly indented."
-  :type 'integer
-  :group 'lisp-indent)
+  :type 'integer)
 
 (defcustom lisp-tag-indentation 1
   "Indentation of tags relative to containing list.
 This variable is used by the function `lisp-indent-tagbody'."
-  :type 'integer
-  :group 'lisp-indent)
+  :type 'integer)
 
 (defcustom lisp-tag-body-indentation 3
   "Indentation of non-tagged lines relative to containing list.
@@ -64,32 +62,30 @@ lisp-tag-body-indentation
 as a block at the same indentation as the first s-expression following
 the tag.  In this case, any forms before the first tag are indented
 by `lisp-body-indent'."
-  :type 'integer
-  :group 'lisp-indent)
+  :type 'integer)
 
 (defcustom lisp-backquote-indentation t
   "Whether or not to indent backquoted lists as code.
 If nil, indent backquoted lists as data, i.e., like quoted lists."
-  :type 'boolean
-  :group 'lisp-indent)
+  :type 'boolean)

-(defcustom lisp-loop-keyword-indentation 3
+(defcustom lisp-loop-keyword-indentation 6
   "Indentation of loop keywords in extended loop forms."
   :type 'integer
-  :group 'lisp-indent)
+  :version "28.1")

-(defcustom lisp-loop-forms-indentation 5
+(defcustom lisp-loop-forms-indentation 6
   "Indentation of forms in extended loop forms."
   :type 'integer
-  :group 'lisp-indent)
+  :version "28.1")

-(defcustom lisp-simple-loop-indentation 3
+(defcustom lisp-simple-loop-indentation 1
   "Indentation of forms in simple loop forms."
   :type 'integer
-  :group 'lisp-indent)
+  :version "28.1")
 
 (defcustom lisp-lambda-list-keyword-alignment nil
   "Whether to vertically align lambda-list keywords together.
-- 
2.26.2