From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: Indentation with inline comments in Emacs Date: Sun, 17 Apr 2022 11:06:51 +0000 Message-ID: <15968029-3c0c-9ced-ea8f-3bbc8446d96d@posteo.de> References: <675f8207-b178-6cbf-24a0-6e4e53a057f2@posteo.de> <5c6cec2d-4898-27d5-574b-2fcd75e53a64@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31144"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Taylan Kammer Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Apr 17 13:07:19 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ng2kQ-0007xv-Mj for guile-user@m.gmane-mx.org; Sun, 17 Apr 2022 13:07:18 +0200 Original-Received: from localhost ([::1]:41394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng2kO-0005b0-Rb for guile-user@m.gmane-mx.org; Sun, 17 Apr 2022 07:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng2k9-0005Zx-Tt for guile-user@gnu.org; Sun, 17 Apr 2022 07:07:02 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:49333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng2k5-0000z8-Uw for guile-user@gnu.org; Sun, 17 Apr 2022 07:07:01 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 03B59240028 for ; Sun, 17 Apr 2022 13:06:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1650193613; bh=Ldj8/tgBx8wveMnoqZFB1pziG7klB0za/BnO3EZyKrQ=; h=Date:Subject:To:Cc:From:From; b=H5fkAexQLJm0GxamaDd2U8jUJa6tn9m+sirIbegBhTCNdDYVG27Df707Ju7yb0ATG +ed616/9dGC5PUIL3CB+plzApR01STL1T8UqkUKTPCOvNAk08MFb+K7CFM5Hy37KpD qKsg69mFLbuSCpI0ocI8sryxkx6Ymrd8pO1dP0OH+mrmEVS2Mn68u0FopksTNKmHsl +ohWkfoKLpz++f3I9TLoFZH3dF1y7PhmFvfRvYe9SP+xGhHJePtF7dJISkDyX4B+ff IOrzj9vxMaShUxM9EBCblErkf8i33PTLThKvi9WQ4oEjc9Vm8HQenBPJO9uE6kgN2M cOazOWcrb2TCQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Kh6hX0lpFz6tn5; Sun, 17 Apr 2022 13:06:52 +0200 (CEST) Content-Language: en-US In-Reply-To: <5c6cec2d-4898-27d5-574b-2fcd75e53a64@gmail.com> Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18248 Archived-At: Hello Taylan! On 4/17/22 05:03, Taylan Kammer wrote: > On 16.04.2022 14:12, Zelphir Kaltstahl wrote: >> Hello Guile users! >> >> The subject might not be only Guile related, but I figure, that many on this mailing list are using Emacs for writing Guile code. I wonder, if anyone has some trick for fixing the following indentation issue: >> >> Sometimes I want to put inline comments with #||# in things like lists, arguments for function calls or vectors. For example I want to write the name of the month next to the number of days of that month, in a vector creation. Here is the example: >> >> ~~~~ >> (define DAYS-IN-MONTH >>   #(#|January|# 31 >>                 #|February|# 28 >>                              #|March|# 31 #|April|# 30 #|May|# 31 #|June|# 30 #|July|# 31 #|August|# 30 >>                               30 30)) >> ~~~~ >> >> As you can see, the indentation is adjusted each line according to the non-comment thing on the previous line, when I press TAB or whatever other key binding one has for indentation. However, in this case I would rather want it to adjust indentation. Is there a quick fix for this? Or some way to make Emacs understand this as a separate case and have it indent "correctly"? Does anyone have a solution? >> >> Regards, >> Zelphir >> > To be honest, the easiest thing to do here is probably use a different comment style. > > In this particular example I would probably just go full vertical: > > (define DAYS-IN-MONTH > #(31 ;january > 28 ;february > 31 ;march > 30 ;april > 31 ;may > ;; ... > ) > > I know it doesn't fulfill your requirement, but usually I find it wise to use the > "path of least resistance" when it comes to how an editor/IDE wants to format code > and just go with the rules it has. Makes life easier for others who might not have > whatever custom configuration you add to your editor to bend it to your will. Good point! For some reason I always shun the single semi-colon comments. I think that is, because I usually start writing such a comment and then notice, that the comment will make the line very long, so I want to break it. However, to break it, it makes more sense to have the comment above the line and use double semi-colon. In this case however, the single semi-colon does actually seem like a good alternative. > Tangential: > > I've also tried out a "columns" variant with multiple numbers per row and a comment > above each row identifying the numbers, but Emacs seems to insist on special-casing > the first column in that case, regardless of comments, like this: > > (define days > #(31 28 31 > 30 31 30 > xx yy zz > ;; ... > )) > > That's already ugly without comments, and IMO a significant issue. > > Maybe it would be good to teach Emacs to indent lists/vectors that don't represent > a function/macro call. This indentation clearly assumes that the leading "31" in > the vector is the operator, and the rest of the vector operands. > > It should probably not assume that for vectors #(...) and quoted lists '(...). I never understood, why Emacs indented that way, but now I understand. First argument is seen as special, as the function/procedure that is being called – aha! I do not know, whether the syntax for vector creation #(...) is the same in all Scheme dialects, which have vectors, in general. Perhaps it would require a specific GNU Guile mode for Emacs, if it is not the same in all Scheme dialects. Best regards, Zelphir -- repositories: https://notabug.org/ZelphirKaltstahl