|
From: | Dmitry Gutov |
Subject: | Re: emacs-29 b18754bb179: Minor improvements in c-ts-mode and docs |
Date: | Wed, 15 Feb 2023 20:50:30 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
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-dwimYou 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 isAlternatively, 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.
[Prev in Thread] | Current Thread | [Next in Thread] |