From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#59662: 29.0.50; [PATCH] Add treesit--indent-defun Date: Thu, 8 Dec 2022 03:37:54 +0200 Message-ID: <4d605e69-7df9-6480-c1c5-dcb22abd3bde@yandex.ru> References: <5B538888-E454-4F75-B3B8-AB20E10B3E89@gmail.com> <83o7sniokt.fsf@gnu.org> <4D5A1640-4F0F-4C21-8ED6-770B88A870EA@thornhill.no> <83r0xhdluq.fsf@gnu.org> <3e25eadb-3f2b-f92d-8b18-bf1daca91b64@yandex.ru> <83wn78cqz4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------huhqv3iE4JfQ03r8DomzDXhr" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5572"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: casouri@gmail.com, 59662@debbugs.gnu.org, theo@thornhill.no, casouri@gmail.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 02:39:25 2022 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 1p35sj-0001Jq-PR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 02:39:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p35sQ-00009P-RE; Wed, 07 Dec 2022 20:39:06 -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 1p35sN-000096-TZ for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 20:39: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 1p35sM-0002ao-F0 for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 20:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p35sM-0007ya-1Z for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 20:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Dec 2022 01:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59662 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59662-submit@debbugs.gnu.org id=B59662.167046348630651 (code B ref 59662); Thu, 08 Dec 2022 01:39:02 +0000 Original-Received: (at 59662) by debbugs.gnu.org; 8 Dec 2022 01:38:06 +0000 Original-Received: from localhost ([127.0.0.1]:53431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p35rR-0007yJ-TN for submit@debbugs.gnu.org; Wed, 07 Dec 2022 20:38:06 -0500 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:38777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p35rP-0007xu-NU for 59662@debbugs.gnu.org; Wed, 07 Dec 2022 20:38:04 -0500 Original-Received: by mail-wm1-f48.google.com with SMTP id r65-20020a1c4444000000b003d1e906ca23so2388119wma.3 for <59662@debbugs.gnu.org>; Wed, 07 Dec 2022 17:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:sender:from:to:cc:subject :date:message-id:reply-to; bh=wpeJmOHHEMCpZy5hk1xqOqAbT4K557kPRwOV5fIQbc0=; b=bE2qHYU2GR2e2AxXzGDeeG3NxBNPmGHRezEQP606FZahM53bE6Qa3rh+n/Vq8jF5WY +pJtZrlDgqXyg3WFJD6v5FB2j905ga/3fte7iZB/8HJ1YyzMBdjGqury2dTo1tRIDAEY ryzUq1AC2at6lqDIMITDWsJBGaNHuaG9pkl3NQwKCeojW3YnI8TLs4cagyJmVd7p7qpP ssQmKXHL26vRUG4E7O9xTmyejhTHJqjhQZkR2B9yu5RjKMh5mHq/nLg11lB73ij1/cK6 HOCMnAj4qJa/Mul+oQ3i2pVmIDruNBAm+hzcVq06wp2wR5y4ffNFIzYTe9+3hXDyBZqZ BpBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wpeJmOHHEMCpZy5hk1xqOqAbT4K557kPRwOV5fIQbc0=; b=XaRVpgEr5qasVS4XK2LVmCWGDcV/SqdviUOFNnrOKg6jyErIeVLU2BkkR4+kP8Bj0r V+D/7ZhJfNJKsb9uPBpMqUhWn2yrJqRMdqXE8phIuHrhiG8Nxwe50LxKn2fXyNd64blV MOraKhILU9Jv4uzcDy1srWhg8+cxJ21vd103AVjPwJrkUpD/Ng9U9jYt6WPNWW3njtoH ueJWtzIdeEufEJ7m96S9VKjMuXyFLXyRHtVm5/qtxl1JkouB+I6dYigLBSMM/2lOFykB Bd5AVbyoCE9ppoqUhxzOJZjOhrEtoojXdnRuMJVxA69ADF60gvzArRP8avxUvBiazZQJ 2sLQ== X-Gm-Message-State: ANoB5pldmRxSR6Y/WB0BJr2+JFYlFMIPyU2pN8+UkrWeWvp2hvzTrRhP 0ZoQVbnM5fUFjyjPbjZD8/4= X-Google-Smtp-Source: AA0mqf5AE7HAXYrbeOjCkFm3VUbjWR5XvY4hhm3DQZfnz67KKOLcWuxD4q7h7J/B8G/gZfmkKZRG5A== X-Received: by 2002:a05:600c:1826:b0:3cf:608b:1b6a with SMTP id n38-20020a05600c182600b003cf608b1b6amr60501654wmp.20.1670463477618; Wed, 07 Dec 2022 17:37:57 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id k32-20020a05600c1ca000b003b4ff30e566sm9259899wms.3.2022.12.07.17.37.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Dec 2022 17:37:56 -0800 (PST) Content-Language: en-US In-Reply-To: <83wn78cqz4.fsf@gnu.org> 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:250235 Archived-At: This is a multi-part message in MIME format. --------------huhqv3iE4JfQ03r8DomzDXhr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 03/12/2022 19:54, Eli Zaretskii wrote: >> paredit-reindent-defun, like I described, does all that too. But when >> outside strings and comments, it reindents the current defun. > So maybe paredit-reindent-defun doesn't need any fixes, but using it as a > role model for the C-like languages is not TRT, since in C these are two > separate commands with two different key bindings. It's not a given that the current state of things must automatically be optimal. But of course I can't vouch whether this behavior is optimal for every language. And major modes will continue to be able to rebind these key sequences. >> AFAICT, these behaviors are quite compatible. But paredit's binding >> seems to be useful in more contexts. > I'm fine with trying something like that on master, to see whether users > like this conflation, but not on the release branch. Here's a patch that people can try. From my brief testing, seems useful enough. I suppose some might dislike it, though, in some codebases where the methods/functions are consistently longer than a screenful. I do like this binding in Emacs Lisp too, though. --------------huhqv3iE4JfQ03r8DomzDXhr Content-Type: text/x-patch; charset=UTF-8; name="prog-reindent-defun.diff" Content-Disposition: attachment; filename="prog-reindent-defun.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvcHJvZ21vZGVzL3Byb2ctbW9kZS5lbCBiL2xpc3AvcHJvZ21v ZGVzL3Byb2ctbW9kZS5lbAppbmRleCA1OGNiNDhmMTgyLi40NmJhY2VhNzM3IDEwMDY0NAot LS0gYS9saXNwL3Byb2dtb2Rlcy9wcm9nLW1vZGUuZWwKKysrIGIvbGlzcC9wcm9nbW9kZXMv cHJvZy1tb2RlLmVsCkBAIC0xMDIsNyArMTAyLDggQEAgcHJvZy1jb250ZXh0LW1lbnUKIAog KGRlZnZhci1rZXltYXAgcHJvZy1tb2RlLW1hcAogICA6ZG9jICJLZXltYXAgdXNlZCBmb3Ig cHJvZ3JhbW1pbmcgbW9kZXMuIgotICAiQy1NLXEiICMncHJvZy1pbmRlbnQtc2V4cCkKKyAg IkMtTS1xIiAjJ3Byb2ctaW5kZW50LXNleHAKKyAgIk0tcSIgIydwcm9nLXJlaW5kZW50LWRl ZnVuKQogCiAoZGVmdmFyIHByb2ctaW5kZW50YXRpb24tY29udGV4dCBuaWwKICAgIldoZW4g bm9uLW5pbCwgcHJvdmlkZXMgY29udGV4dCBmb3IgaW5kZW50aW5nIGVtYmVkZGVkIGNvZGUg Y2h1bmtzLgpAQCAtMTQ0LDYgKzE0NSwyNiBAQCBwcm9nLWZpcnN0LWNvbHVtbgogICAiUmV0 dXJuIHRoZSBpbmRlbnRhdGlvbiBjb2x1bW4gbm9ybWFsbHkgdXNlZCBmb3IgdG9wLWxldmVs IGNvbnN0cnVjdHMuIgogICAob3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