From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61923: 30.0.50; go-ts-mode, multiline raw-string-literal wrong indentation Date: Fri, 03 Mar 2023 13:38:47 +0200 Message-ID: <83zg8uawu0.fsf@gnu.org> References: <877cvz5b0t.fsf@posteo.net> <83o7paco3n.fsf@gnu.org> <87fsam3wk7.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61923@debbugs.gnu.org To: Gleb Zakharov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 03 12:40:29 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pY3m1-0009yb-3P for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Mar 2023 12:40:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pY3lc-0006ai-M1; Fri, 03 Mar 2023 06:40:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY3lb-0006WO-A8 for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 06:40:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pY3la-0001JP-Iz for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 06:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pY3la-0002sd-1e for bug-gnu-emacs@gnu.org; Fri, 03 Mar 2023 06:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2023 11:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61923 X-GNU-PR-Package: emacs Original-Received: via spool by 61923-submit@debbugs.gnu.org id=B61923.167784355110991 (code B ref 61923); Fri, 03 Mar 2023 11:40:02 +0000 Original-Received: (at 61923) by debbugs.gnu.org; 3 Mar 2023 11:39:11 +0000 Original-Received: from localhost ([127.0.0.1]:59819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY3kk-0002rD-G4 for submit@debbugs.gnu.org; Fri, 03 Mar 2023 06:39:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pY3kj-0002r0-8e for 61923@debbugs.gnu.org; Fri, 03 Mar 2023 06:39:09 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY3kd-0000nx-HN; Fri, 03 Mar 2023 06:39:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=0mgmtGhND3q+sOe7P62zlX2wkQ4hx9ILlzZVej6q8Wk=; b=c8FIytoi4hfJ 07n5MIRey3wdxz8wG7yDJwhXXkI0nKWubcnQx+BaLL6v0lmn9qqQw/EOIBDtoHDXkY3zfgASCieEV YCrl6OThHpFyA1dffd+4DAcVQOWA2XqMic5B4MLkHKcaMAJWWkR3NsiGQIEcLsM5PGf14+jn89gVg XiCSX81UadUAil27AhTM93Z9jSw58nOoFcbu39xIBlWuVp19Bo/Q2gcRdm5P9RmbTabVUdLJCmGRd P3hRLRAjJk9TF8ZLlutoLhNI/VCEZdsfx6k4mtkGDtVfmCN/nM/5QiQxm9tYqC+z+9iUAJaEuZPj3 5XJHt406TqjfC5Tni55YXg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pY3kd-0002GZ-0w; Fri, 03 Mar 2023 06:39:03 -0500 In-Reply-To: <87fsam3wk7.fsf@posteo.net> (message from Gleb Zakharov on Fri, 03 Mar 2023 11:26:32 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:257208 Archived-At: [Please always use Reply All to keep the bug address on the CC list.] > From: Gleb Zakharov > Date: Fri, 03 Mar 2023 11:26:32 +0000 > > Hi Eli, > Thanks for the quick reply. > > Eli Zaretskii writes: > > Tweaking the language indentation > > rules to cater for these quite specialized use cases is not TRT, IMO, > > because it is likely to contradict what the majority of language users > > want and expect. > > I'm not sure if you meant that the special case involves embedding other > languages or simply using multi-line strings. The latter. AFAIU, you suggested to change how multi-line strings are indented because of the use case of embedding other languages there. > While raw strings in Go can be used for various purposes, > including the code of other languages, they can also be used for > arbitrary text. The issue I'm facing is that when tabs are added by > tree-sitter indentation, they become a part of the string, which can > affect the program, for example if we want to compare strings with each > other. > > Consider this example: > ``` > // (require 'treesit) > // (require 'go-ts-mode) > // (setq treesit-extra-load-path '("/home/snyssfx/.guix-home/profile/lib/tree-sitter")) > // (go-ts-mode) > > func a() { > _ = ` > Lorem ipsum dolor sit amet, > consectetur adipiscing elit, > sed do eiusmod tempor incididunt ut > labore et dolore magna aliqua. > ` > } > ``` > > If I call M-q or make a change somewhere in the string, part of the text inside > the string will be re-indented, > which will result in additional \t symbols in the string literal. > > I can undo this indentation with C-/ though, which is how I do it now. If you are saying that the indentation inside string is incorrect in general, then I agree we should fix it. (I don't use Go.) But then please present the reproduction recipe which doesn't use another language in the string, but simply has a string, which is corrupted by indentation. > > This use case, and others > > like it, are supposed to be handled by features that support multiple > > major modes in the same buffer. > > Thanks for the tip, I will take a look, for example indirect buffers can > certainly improve my experience here. > > Best Regards, > Gleb >