unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: emacs-29 b18754bb179: Minor improvements in c-ts-mode and docs
Date: Wed, 15 Feb 2023 20:50:30 +0200	[thread overview]
Message-ID: <1b6e0f64-35db-36f3-8d80-c3340ec50bbe@yandex.ru> (raw)
In-Reply-To: <Y+0lCJh6vZtj2oKI@ACM>

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.



  reply	other threads:[~2023-02-15 18:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167648414913.7595.16030168421819097011@vcs2.savannah.gnu.org>
     [not found] ` <20230215180229.75FF5C00613@vcs2.savannah.gnu.org>
2023-02-15 18:14   ` emacs-29 b18754bb179: Minor improvements in c-ts-mode and docs Dmitry Gutov
2023-02-15 18:31     ` Alan Mackenzie
2023-02-15 18:50       ` Dmitry Gutov [this message]
2023-02-15 19:37         ` Eli Zaretskii
2023-02-15 20:25           ` Dmitry Gutov
2023-02-16  7:09             ` Eli Zaretskii
2023-02-16 11:15               ` Dmitry Gutov
2023-02-16 12:01                 ` Eli Zaretskii
2023-02-15 19:44         ` Alan Mackenzie
2023-02-15 20:29           ` Dmitry Gutov
2023-02-16  7:11             ` Eli Zaretskii
2023-02-15 18:35     ` Eli Zaretskii
2023-02-15 18:53       ` Dmitry Gutov
2023-02-15 19:39         ` Eli Zaretskii
2023-02-15 20:32           ` Dmitry Gutov
2023-02-16  7:32             ` Eli Zaretskii
2023-02-16 11:17               ` Dmitry Gutov
2023-02-16 12:03                 ` Eli Zaretskii
2023-02-16 12:51                   ` Dmitry Gutov
2023-02-16 15:19                     ` Eli Zaretskii
2023-02-16 15:38                       ` Dmitry Gutov
2023-02-16 15:53                         ` Theodor Thornhill
2023-02-16 15:58                         ` Eli Zaretskii
2023-02-16 20:09                           ` Dmitry Gutov
2023-02-16 20:22                             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b6e0f64-35db-36f3-8d80-c3340ec50bbe@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).