all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Dmitry Gutov <dgutov@yandex.ru>
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 19:44:57 +0000	[thread overview]
Message-ID: <Y+02OdXRo1Z0dvBR@ACM> (raw)
In-Reply-To: <1b6e0f64-35db-36f3-8d80-c3340ec50bbe@yandex.ru>

Hello, Dmitry.

On Wed, Feb 15, 2023 at 20:50:30 +0200, Dmitry Gutov wrote:
> 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.

There are five distinct function (at least) in comment-dwim.  I'm
unconvinced it's a good idea to try to make them all work under a single
key binding.

> 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

That would not allow the user, with transient-mark-mode disabled, to
choose between commenting the region and adding a comment to the current
line.

> 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 C-c C-c binding has other bindings in various major modes.

> > 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.

I think they do.  It is inconvenient having to type M-x comment-region
in, for example, texinfo-mode.

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2023-02-15 19:44 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=Y+02OdXRo1Z0dvBR@ACM \
    --to=acm@muc.de \
    --cc=dgutov@yandex.ru \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.