From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command Date: Fri, 03 May 2024 14:04:17 +0300 Message-ID: <86seyzi2by.fsf@gnu.org> References: <871q9g8z8k.fsf@posteo.net> <87wmob73ds.fsf@posteo.net> <861q6jji0i.fsf@gnu.org> <87o79n6uj6.fsf@posteo.net> <86v83vi2kr.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31141"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, 69097@debbugs.gnu.org To: philipk@posteo.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 03 13:05:55 2024 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 1s2qji-0007nx-NE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 May 2024 13:05:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2qja-0000Kv-1Y; Fri, 03 May 2024 07:05:46 -0400 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 1s2qjU-0000Fb-Kw for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 07:05:42 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2qjT-0006Jv-Mh for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 07:05:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2qjp-0002FI-W3 for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 07:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 May 2024 11:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69097 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69097-submit@debbugs.gnu.org id=B69097.17147343038606 (code B ref 69097); Fri, 03 May 2024 11:06:01 +0000 Original-Received: (at 69097) by debbugs.gnu.org; 3 May 2024 11:05:03 +0000 Original-Received: from localhost ([127.0.0.1]:46387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2qit-0002Ek-6p for submit@debbugs.gnu.org; Fri, 03 May 2024 07:05:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2qir-0002EI-Js for 69097@debbugs.gnu.org; Fri, 03 May 2024 07:05:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2qiP-000692-QM; Fri, 03 May 2024 07:04:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rFyPH/SIFaJEXmtCpwz0Y1V1DsT0MYiqYk9cwxDH2rw=; b=Cm4P6Ng9ifvQ aLBZtW5V2dX05oUef7G0kd9bYGzSRTQYhrJGcTp7vf5UGTSZbrSIK+NnrLULkEgtM4qzc7UVDFGPG fwH2Q9ernD6zlHeHgFiVSj6Kbs+lg5IE4H9M4Ebk0meWvwCJwIlZUe/Rt+u/v921UreMk0xduqOIm vIu0c7bbWEKt/Opradf8fS4OpettXimMpNHIAMMKnoXrDIlAEgU8IztX4oQcB50i4+vdtI5hxuHDA nvIuqLW1TpNMad+pWQ4L8UHjrILaGycAwVVua6Jby4HGMG3S6cQ1342MsO/Hkd2eqk5FR2QORNNAJ lml3d4K/D4o+c2a/mi1Evg==; In-Reply-To: <86v83vi2kr.fsf@gnu.org> (message from Eli Zaretskii on Fri, 03 May 2024 13:59:00 +0300) 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:284377 Archived-At: > Cc: rms@gnu.org, 69097@debbugs.gnu.org > Date: Fri, 03 May 2024 13:59:00 +0300 > From: Eli Zaretskii > > > From: Philip Kaludercic > > Cc: 69097@debbugs.gnu.org, Richard Stallman > > Date: Fri, 03 May 2024 10:48:13 +0000 > > > > > More to the point, can you explain why we need this, given the > > > existence of kill-word? > > > > > > Also, this kills backward, something that is not evident, neither from > > > the name of the command nor from the doc string (and the obscure > > > reference to Unix doesn't help, IMO). > > > > > > Finally, having another command that kills the region doesn't seem > > > justified, or is it? > > > > The motivation is sort of the same as with generalising `upcase-word' to > > `upcase-dwim'. If there is no active region, it behaves like > > `backward-kill-word' (which is what C-w does in a terminal as well), but > > if there is an active region it reverts to `kill-ring-save'. > > If so, then (assuming we decide to accept this change), the name of > the command should be something like kill-word-dwim, and the doc > string should mention the two commands you refer to above. > > > I have this in my personal configuration for ages, and it is always > > one of the first things I re-implement when using an Emacs without a > > custom init.el. > > Any reason why you need this command and cannot settle for the two > commands it replaces heuristically? Are you using Emacs with > transient-mark-mode on or off? And one more question: currently C-w signals an error if there's no region. So another idea is to extend C-w to delete the word at point if there's no region (where "no region" means "no active region" if transient-mark-mode is ON, otherwise it means "no mark set").