unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rms@gnu.org, 69097@debbugs.gnu.org
Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command
Date: Fri, 03 May 2024 17:32:35 +0000	[thread overview]
Message-ID: <87cyq26bt8.fsf@posteo.net> (raw)
In-Reply-To: <86seyzi2by.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 May 2024 14:04:17 +0300")

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





  reply	other threads:[~2024-05-03 17:32 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  9:55 bug#69097: [PATCH] Add 'kill-region-or-word' command Philip Kaludercic
2024-02-17  3:53 ` Richard Stallman
     [not found]   ` <87ttm7gi9i.fsf@posteo.net>
2024-02-19  3:44     ` Richard Stallman
     [not found]       ` <87sf1obkw9.fsf@posteo.net>
2024-02-23  3:04         ` Richard Stallman
     [not found]           ` <871q93rzv8.fsf@posteo.net>
2024-02-25  3:16             ` Richard Stallman
     [not found]               ` <87frxgn73g.fsf@posteo.net>
2024-02-27  3:12                 ` Richard Stallman
2024-05-03  7:37 ` Philip Kaludercic
2024-05-03 10:40   ` Eli Zaretskii
2024-05-03 10:48     ` Philip Kaludercic
2024-05-03 10:59       ` Eli Zaretskii
2024-05-03 11:04         ` Eli Zaretskii
2024-05-03 17:32           ` Philip Kaludercic [this message]
2024-05-03 18:01             ` Eli Zaretskii
2024-05-03 19:41               ` Philip Kaludercic
2024-05-04  6:20                 ` Eli Zaretskii
2024-05-05  6:53                 ` Juri Linkov
2024-05-05  9:04                   ` Eli Zaretskii
2024-05-05 16:29                     ` Juri Linkov
2024-05-05 16:54                       ` Philip Kaludercic
2024-05-05 16:59                         ` Juri Linkov
2024-05-05 17:08                           ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-05 18:27                           ` Philip Kaludercic
2024-05-05 17:05                         ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-05 17:13                           ` Eli Zaretskii
2024-05-05 17:53                             ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06  0:21                       ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06 16:46                     ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06 16:51                       ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-06 17:55                         ` Eli Zaretskii
2024-05-07  8:47                           ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-07  8:47                             ` Sean Whitton via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-05 16:47                   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03 16:20         ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyq26bt8.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=69097@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).