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.devel Subject: Re: emacs-29 b18754bb179: Minor improvements in c-ts-mode and docs Date: Wed, 15 Feb 2023 20:50:30 +0200 Message-ID: <1b6e0f64-35db-36f3-8d80-c3340ec50bbe@yandex.ru> References: <167648414913.7595.16030168421819097011@vcs2.savannah.gnu.org> <20230215180229.75FF5C00613@vcs2.savannah.gnu.org> <6bd367b5-f4fc-0727-a1fc-08dfadc15c1a@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28671"; 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: emacs-devel@gnu.org, Eli Zaretskii To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 15 19:51:13 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pSMs5-0007GX-RS for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Feb 2023 19:51:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSMrW-0002Ni-Jz; Wed, 15 Feb 2023 13:50:38 -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 1pSMrV-0002NA-0J for emacs-devel@gnu.org; Wed, 15 Feb 2023 13:50:37 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSMrT-0005oM-1K; Wed, 15 Feb 2023 13:50:36 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id z13so14052528wmp.2; Wed, 15 Feb 2023 10:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding: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=ih2kbOBYSQv6SnxE+Yjza3pfxAS7Fb+nXzXFZ7JPhx8=; b=isQZZK1YZrGwf4m8rF2rj1V50RGilRUZoEc2fQfEYkR/lG03P3x2OjFuI7LRldzlTY PooGbAVzmutiXiDWW5ZYi7rKnkrX2gf2SChfxHIBB/BCWXkgJxPua3VIPlbwqKfLfcvI TkoljjrdBQozRBm7u0aLtBm6Jej+8+do9S8ZngFkXaiRquL5AaQ8im58OiIF2NzYe9F8 mAXa8AFp9TQjUImRg3Ea2OEEFOFRFvDMgTs/xyUV+gJfXzkX5F2xwgg7lzrLkITr0yRc iLF9IVxbynJb5/IWKoGBXjg9jdeN6KWoCujwroZJRh55r+Qekg6hkArDDix36LZNo9c1 GGQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=ih2kbOBYSQv6SnxE+Yjza3pfxAS7Fb+nXzXFZ7JPhx8=; b=JGETHDmrdIepx3yraKcQGI8DfS9lmuJn/BhgyaTwkMN3R9ldM5HLWJ+0Th43H0ggy5 FHCA5G+tJwlj2pHC8VKFMC1514HjEv5N8Ghf/6DPE316zHYjtWO1S2g+9stvl67JAXZE aLG3qHYlNnHJ1IrCp+5KqR0y+zTfmvbYsH8szvHnii3W/rOP8zwd+VkcjbLi7/QrGpRf spfmSqi0bot+VwKYJGF0YWH8SX6S4sJBKy+33NfptCa4h6vkn5NV/AzPT2vtdN6V9UHe repxDVYzC7ImXS2Ig9HTdhDhjH1tkCmtfFcPAL4NXZ9s5wuKFu45XNDZYzqhro13YfGR 8WaQ== X-Gm-Message-State: AO0yUKVxKuVtO3192PtxZtQALp732t3I23QnmnlFP7nFSUonH8rk1Y2j AP9KVv9qXONKDH40a2bHjrQ= X-Google-Smtp-Source: AK7set+W9KEYVC4UTJFElaqLpZ2hGLiUxzCRPoOgz+6AVpyOUMlFR/kQqjHmQWKupLPsbw/1tIWWbQ== X-Received: by 2002:a05:600c:c0e:b0:3df:f860:3089 with SMTP id fm14-20020a05600c0c0e00b003dff8603089mr2876725wmb.32.1676487032506; Wed, 15 Feb 2023 10:50:32 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u15-20020a05600c19cf00b003dc53217e07sm3135346wmq.16.2023.02.15.10.50.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 10:50:31 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=raaahh@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.257, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303324 Archived-At: On 15/02/2023 20:31, Alan Mackenzie wrote: > Hello, Dmitry. > > On Wed, Feb 15, 2023 at 20:14:29 +0200, Dmitry Gutov wrote: >> On 15/02/2023 20:02, Eli Zaretskii wrote: >>> + "C-c C-c" #'comment-region) > >> Should we maybe take this opportunity to introduce c-ts-mode's users to >> the common bindings we use in other modes? > >> 'M-;' seems to work just fine for commenting code already. And it has >> more capabilities than 'comment-region'. > > M-; can only comment the region when transient-mark-mode is enabled. If M-; doesn't work adequately with transient-mark-mode off, it seems like an area for improvement. E.g. like this: diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 022bf3059be..effa90371e5 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1364,7 +1364,8 @@ comment-dwim You can configure `comment-style' to change the way regions are commented." (interactive "*P") (comment-normalize-vars) - (if (use-region-p) + (if (or (not transient-mark-mode) + (use-region-p)) (comment-or-uncomment-region (region-beginning) (region-end) arg) (if (save-excursion (beginning-of-line) (not (looking-at "\\s-*$"))) ;; FIXME: If there's no comment to kill on this line and ARG is Alternatively, turning transient-mark-mode off would add the comment-region binding globally (for those who want to stay with the legacy behavior) but keep the binding free otherwise. > The flip-side of "has more capabilities" is "doesn't do one thing and do > it well". > > In practice, in C Mode, I use both C-c C-c and M-;, depending on whether > I'm (un)commenting the region or a single line. I think the C-c C-c > binding should remain. I just don't see why C Mode needs that binding, whereas all other language modes don't.