From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command Date: Fri, 03 May 2024 17:32:35 +0000 Message-ID: <87cyq26bt8.fsf@posteo.net> References: <871q9g8z8k.fsf@posteo.net> <87wmob73ds.fsf@posteo.net> <861q6jji0i.fsf@gnu.org> <87o79n6uj6.fsf@posteo.net> <86v83vi2kr.fsf@gnu.org> <86seyzi2by.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12856"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, 69097@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 03 19:34:10 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 1s2wnS-000355-69 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 May 2024 19:34:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2wn9-00062D-Q7; Fri, 03 May 2024 13:33:51 -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 1s2wmx-0005iD-Mt for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 13:33:40 -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 1s2wmx-0001Es-EJ for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 13:33:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s2wnJ-0004kt-Ts for bug-gnu-emacs@gnu.org; Fri, 03 May 2024 13:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 May 2024 17:34: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.171475759218251 (code B ref 69097); Fri, 03 May 2024 17:34:01 +0000 Original-Received: (at 69097) by debbugs.gnu.org; 3 May 2024 17:33:12 +0000 Original-Received: from localhost ([127.0.0.1]:47855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2wmW-0004kJ-5q for submit@debbugs.gnu.org; Fri, 03 May 2024 13:33:12 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:45877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s2wmQ-0004jt-Oa for 69097@debbugs.gnu.org; Fri, 03 May 2024 13:33:10 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 52B0A240103 for <69097@debbugs.gnu.org>; Fri, 3 May 2024 19:32:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1714757557; bh=DLJKRfxBSIU6M3VrMjgKV+CZyIZFNZDUSSFJA22VWGs=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=VWaFDYWiGY0eFN0OIInIxvIKfZ4HunsCzFKOH+sOehjDX97sWylqeFwB9hoCTolh2 6vvspN+gA2zUcsU4VokpDAusdsHAccs3c5ynYScoNRS5zIfG189vtwvk92mgxnRtIZ m5p0o6G1qq5LOuN3cmJic5C5IiBJ4fRQZjiagvHO9/ZTbz5sEWS5H18t7+d2Xcp+lw tTkWs56/Zhwg6ydF/mA1Zk/4seeM4uFUasI90qPJwJXu/9IVN4HTeV4cSsace1qqL6 qgQ+KGHwLeDOdYp1qFYFJRhG4mDYFR6tpmjr52ZuvBlJwb19NN68TRZpryIeJHsVQU fBAColWO4NqSQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VWHtr56hwz9rxL; Fri, 3 May 2024 19:32:36 +0200 (CEST) In-Reply-To: <86seyzi2by.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 May 2024 14:04:17 +0300") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt 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:284391 Archived-At: Eli Zaretskii writes: >> 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"). That is basically what my command does (with the difference that I don't just check if (mark) is non-nil but also if (use-region-p) is non-nil), just not part of kill-region. I don't know if this is too invasive, if users are used to this error being signalled. Perhaps it can be protected by a user option? -- Philip Kaludercic on peregrine