[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69097: [PATCH] Add 'kill-region-or-word' command
From: |
Drew Adams |
Subject: |
bug#69097: [PATCH] Add 'kill-region-or-word' command |
Date: |
Sun, 5 May 2024 16:47:30 +0000 |
> > +(defcustom kill-word-if-no-region nil
> > + "Non-nil means that `kill-region' without a region will kill the
> last word."
> > + :type 'boolean
> > + :group 'killing)
>
> What a strange thing. `kill-region' is not related to word commands
> in no way. Why not kill a sentence? Why not kill a line? Why just
> word?
>
> All existing commands handle an active region. But there is no commands
> that do in the opposite direction where a general command handles
> one random specific case. This is because the region is a more
> general concept.
+1. Finally some sense in this thread.
If there's no mark in a buffer when you use C-w
the logical behavior is to raise an error telling
you exactly that. Emacs was wise to do this.
No mark means no region, which means no region to
kill. (And how often does anyone see this error
when using C-w?)
___
Just as bad as giving C-w this unhelpful behavior
was redefining `kill-region' to give it the new
behavior, instead of binding C-w to a new command.
___
Having no mark is different from having an empty
region (whether or not transient-mark-mode is on).
An empty region is a bona fide region. Killing
an empty region works; as does yanking it. An
empty string on the kill ring affects yanking
just as one would expect. Code can depend on it.
- bug#69097: [PATCH] Add 'kill-region-or-word' command, (continued)
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Sean Whitton, 2024/05/05
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Sean Whitton, 2024/05/06
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Sean Whitton, 2024/05/06
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Eli Zaretskii, 2024/05/06
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Sean Whitton, 2024/05/07
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Sean Whitton, 2024/05/07
- bug#69097: [PATCH] Add 'kill-region-or-word' command,
Drew Adams <=
- bug#69097: [PATCH] Add 'kill-region-or-word' command, Philip Kaludercic, 2024/05/03
bug#69097: [PATCH] Add 'kill-region-or-word' command, Richard Stallman, 2024/05/03