From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.user Subject: Re: Indentation with inline comments in Emacs Date: Sun, 17 Apr 2022 05:03:08 +0200 Message-ID: <5c6cec2d-4898-27d5-574b-2fcd75e53a64@gmail.com> References: <675f8207-b178-6cbf-24a0-6e4e53a057f2@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26008"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 To: Zelphir Kaltstahl , guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Apr 17 05:03:32 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 1nfvCG-0006ba-Kx for guile-user@m.gmane-mx.org; Sun, 17 Apr 2022 05:03:32 +0200 Original-Received: from localhost ([::1]:40180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nfvCF-0006sn-0y for guile-user@m.gmane-mx.org; Sat, 16 Apr 2022 23:03:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfvC0-0006sM-1m for guile-user@gnu.org; Sat, 16 Apr 2022 23:03:16 -0400 Original-Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:36557) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nfvBy-0000rk-6l for guile-user@gnu.org; Sat, 16 Apr 2022 23:03:15 -0400 Original-Received: by mail-ej1-x630.google.com with SMTP id k23so21656041ejd.3 for ; Sat, 16 Apr 2022 20:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=ljtMx3xqXL+6At6pJy1aLYBAUDO9iQ9Yq/9S2km1zOE=; b=cTnHf7CxImA+2MRu4NyIWHCw6hfBJ/9XogV0yuv87rfFrDFXYGSB7kUGIO0VS0F3m9 ZHmC78A+kb8Vpo/DK844DvmD+GQTUhkb2xnAQ5JNtbaxdukLrxo9Umq/bgoNahacQGDc bKhQbPHTYBp7bN46ux09SY+QHv0YP2ipYiW9wycV9oZl+kMyd7LzdOeiLFedSBOn0PTB ZDAFrfHJv5qohxZqv0j0V/8HCqWJDQ5ElaAVgTsuNxJmDjxVXYT8aXng/GPHl+kXTwdQ ECrM2VAplZONO9rqBCp8gGbkXF9Rqk07ZP8CCHKBdg2dgQH3E3C/xqtPQ2Ro1kxGjKNV xAgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=ljtMx3xqXL+6At6pJy1aLYBAUDO9iQ9Yq/9S2km1zOE=; b=FG/2Y+sSYO0oszoqk+8abdBvBxbLTcAmEVv++DoJ50cVoGEJiW5LgPIo9AqqCnK/TY gA5MvRHylOPicU3EurgHIvplIbcCgDuHWGDzRuSNVXVAJ4TeUxaxj2KAjVt8jH2BTGJg ptXbD4oDe/DSrsyh//GbxwLjB0vA/01fn+BxGZ9TVmqpkyU5uKeoiAjzHVIBOc0VYTpT MMfqBWRz4HGioW6UQM6eCEJhIIJkKm+AMp5j/us0ymW/h2CXqPmLyjr/MquGzqkpYH8k bzkhl6PAbtG0enxYfFvDGU625O3X8TJiepE1qYNqM8O8oAMb35KrEQqj22YxgrtLqPSY rOIg== X-Gm-Message-State: AOAM531ygVp3mkYB2AQbrFnYX+pN1jABemtDFd31Dm2ZDHN8yvbD6qYt mv+w01qh6j6pOsCajZ2hPt0= X-Google-Smtp-Source: ABdhPJylWXJJWbZz2IjgTCEHheA7NX+jeZFlo1rzIOq4kEP+15UDciYSZYl4HTO1y9Au5s66xNd8ng== X-Received: by 2002:a17:907:3e90:b0:6e8:7fbb:a15c with SMTP id hs16-20020a1709073e9000b006e87fbba15cmr4549415ejc.411.1650164591407; Sat, 16 Apr 2022 20:03:11 -0700 (PDT) Original-Received: from [192.168.178.20] (ip-109-090-125-150.um36.pools.vodafone-ip.de. [109.90.125.150]) by smtp.gmail.com with ESMTPSA id bm6-20020a170906c04600b006e89a5f5b8fsm3219335ejb.153.2022.04.16.20.03.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Apr 2022 20:03:10 -0700 (PDT) Content-Language: en-US In-Reply-To: <675f8207-b178-6cbf-24a0-6e4e53a057f2@posteo.de> Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=taylan.kammer@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:18245 Archived-At: 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. 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 '(...). -- Taylan