Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command

From: Eli Zaretskii <[email-masked]>
Date: Wed, 04 Sep 2024 17:21:52 +0300

> From: Sean Whitton <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],
>   [email-masked],  [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 04 Sep 2024 15:07:08 +0100
> 
> > +(defcustom kill-region-dwim nil
> > +  "Behaviour when `kill-region' is invoked without an active region.
> > +If set to nil (default), then an error occurs and nothing is killed.  If
> > +set to `emacs-word', then kill a the last word as defined by the current
> > +major mode.  If set to `unix-word', then kill the last word in the style
> > +of a shell like Bash, disregarding the major mode."
> > +  :type '(choice (const :tag "Kill a word like `backward-kill-word'" emacs-word)
> > +                 (const :tag "Kill a word like Bash would" unix-word)
> > +                 (const :tag "Do not kill anything" nil))
> > +  :group 'killing)
> 
> I think I'm missing something here.  When it's nil and there is no
> *active* region, but there is a region, it should kill that, surely?
> With or without TMM.

Yes, you are right.  It sounds like we made wrong assumptions about
what happens in that case, and should rethink this.

C-w signals an error only if there's no mark in the buffer.

So I guess we need a new command after all.