GNU bug report logs - #69097
[PATCH] Add 'kill-region-or-word' command

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Tue, 13 Feb 2024 09:57:02 UTC

Severity: normal

Tags: patch

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: philipk <at> posteo.net, rms <at> gnu.org, 69097 <at> debbugs.gnu.org, juri <at> linkov.net, stefankangas <at> gmail.com, acorallo <at> gnu.org
Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command
Date: Fri, 06 Sep 2024 14:54:58 +0100
[Message part 1 (text/plain, inline)]
Hello,

On Fri 06 Sep 2024 at 02:30pm +03, Eli Zaretskii wrote:

> Thanks, but I see no reason to document this command in the manual,
> certainly not in the ELisp reference (it's a command, not a function).
> IMO it's obscure enough to be documented only in NEWS.

That's quite fine with me.

> Should this be "[:space:]\\n\\r" instead? if not, why not?
>
> Also note that [:space:] depends on mode-specific syntax table, so I
> question the wisdom of using it in a command that's supposed to be
> mode-agnostic.

Both excellent points, thank you.  I looked at the POSIX standard and
came up with a new default value.

>> +This command is like `forward-word' except that words are always
>> +delimited by whitespace, regardless of the buffer's syntax table.
>> +Like `forward-word', this command respects fields.
>> +
>> +This emulates how C-w at the Unix terminal or shell identifies words.
>> +See the `unix-word-rubout' command in Info node `(readline)Commands For
>> +Killing'."
>
> This should try to be more explicit about what "word" means for this
> command.  Since it's so different from any notion of "word" in Emacs,
> I would even seriously consider not to use that word, or maybe quote
> it (in addition to explaining what it means).

This is very helpful.  You're right.  In the attached, I've tried using
"unix-word".  Let me know what you think of that.

> Also, since this is a command, its doc string should clearly separate
> what happens in interactive invocation from what happens when called
> from Lisp.  DELIM belongs to the latter.  (Is it even useful to
> provide that option for Lisp-only calls? what's the use case for
> that?)
>
> And finally, I wonder why we need this command?  AFAIU, the original
> intent was to implement something similar to unix-word-rubout, not a
> new movement command.  If the plan has changed, I think we need to
> discuss the need once again.

I think it was unhelpful of me to send this in without callers.
I'm sorry about that.

The reason for adding this is that it factors out what is in common
between what Philip is doing, and unix-word-rubout.
So in the attached revised patch, I've included unix-word-rubout.

I've also included a second readline command which I have bound in my
own init.  It demonstrates why there is a need for DELIM.

By the way, forward-unix-word could also be a plain function.
I made it a command because, well, why not.  Let me know if you think it
should be switched back to a function.

-- 
Sean Whitton
[0001-New-commands-for-moving-and-killing-unix-words.patch (text/x-patch, attachment)]

This bug report was last modified 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.