[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69097: [PATCH] Add 'kill-region-or-word' command
From: |
Philip Kaludercic |
Subject: |
bug#69097: [PATCH] Add 'kill-region-or-word' command |
Date: |
Fri, 03 May 2024 17:32:35 +0000 |
Eli Zaretskii <eliz@gnu.org> writes:
>> Cc: rms@gnu.org, 69097@debbugs.gnu.org
>> Date: Fri, 03 May 2024 13:59:00 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>>
>> > From: Philip Kaludercic <philipk@posteo.net>
>> > Cc: 69097@debbugs.gnu.org, Richard Stallman <rms@gnu.org>
>> > 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
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command,
Philip Kaludercic <=
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/03
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/04
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Juri Linkov, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Juri Linkov, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Juri Linkov, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Drew Adams, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/05