From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.bugs Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command Date: Fri, 06 Sep 2024 12:06:21 +0100 Message-ID: <87zfolujma.fsf@zephyr.silentflame.com> References: <871q9g8z8k.fsf@posteo.net> <864jbeixkt.fsf@gnu.org> <874jbe65u0.fsf@posteo.net> <8634qwkbtc.fsf@mail.linkov.net> <86h6fceij2.fsf@gnu.org> <87edaeevmr.fsf@zephyr.silentflame.com> <87a5l2evdn.fsf@zephyr.silentflame.com> <86ikzqbzac.fsf@gnu.org> <87seujf8bb.fsf@posteo.net> <867cbu9uce.fsf@gnu.org> <87cyllg57r.fsf@posteo.net> <87zfopbxdk.fsf@zephyr.silentflame.com> <87seuhbx87.fsf@zephyr.silentflame.com> <87zfopep5q.fsf@posteo.net> <86r0a16i71.fsf@gnu.org> <877cbshf4h.fsf@posteo.net> <87a5gnzf5f.fsf@zephyr.silentflame.com> <87y146jv6z.fsf@posteo.net> <87ikvaxmbm.fsf@zephyr.silentflame.com> <871q1yw4fz.fsf@posteo.net> <877cbpvzkm.fsf@zephyr.silentflame.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1070"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: rms@gnu.org, 69097@debbugs.gnu.org, juri@linkov.net, stefankangas@gmail.com, Eli Zaretskii , acorallo@gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 06 13:39:50 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1smXJe-00006v-1B for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Sep 2024 13:39:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smXJ7-0008PE-7L; Fri, 06 Sep 2024 07:39:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smXIt-00086y-Gf for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 07:39:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smXIt-00043A-6d for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 07:39:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ysU3sJmYVnbDJ1AIY9HkXKPKb8BmpPtskY6xmYBZVn8=; b=Yzt+XxVQq5DuhgAiV/28VyfncmfkEdz8f+tWHfGDfOFysQM36l3j/cf/LSVA44tZO/ARbEOQVNj3YoVMyqas6WmZqeeqUQ8xg/1Poxs4F/Vgjio/HiTo4GfY72rWpeYC+jKpWCoXHYffordM4ZzAIDBuxCd/qGtOjMAItLRGRHnOIY71ikoHgVS2FUlcQPGx3mUUucMBC3xvU9eWLkKVNRi5oqWAECA1AtC4pEMm074V5TB/lDuigLMLG1SMF2MR+mTTOEUha1sESdZWs7YbBW04DQluETTNiEXoeCNeNENZHVF491YbK+5FEV1myLov1g3jDjDeDR5jIaCv6MBXAg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smXIs-00010K-Fp for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 07:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Sep 2024 11:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69097 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69097-submit@debbugs.gnu.org id=B69097.17256226883705 (code B ref 69097); Fri, 06 Sep 2024 11:39:02 +0000 Original-Received: (at 69097) by debbugs.gnu.org; 6 Sep 2024 11:38:08 +0000 Original-Received: from localhost ([127.0.0.1]:52325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smXI0-0000xg-Bk for submit@debbugs.gnu.org; Fri, 06 Sep 2024 07:38:08 -0400 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:49268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smXHv-0000ws-Hz for 69097@debbugs.gnu.org; Fri, 06 Sep 2024 07:38:07 -0400 DKIM-Signature: a=rsa-sha256; b=kmlUrPttb5spv8mu2XepiEEEHK/5Jf9em5+3MwQc/nsgr0+9fowoAnxy2J3daIGcd6bieVLiKot2gaLHFJTWHBTvLAl3t1+SBfV1YJWNo4RkIfjqemoTt+bzut2Mn/RKy4QfAprR1WPc6DUrEFkLRxYtib1P9xD08bSbtrrZSaO+9LTc0SV/fzECvpNSsKT/vC55dJSAKJVj2V1apa2VPU3U4+IRaeSN1iVHcUfPoIkN0A44mE8auHJW/TAx1xelicLS4oj9NyCjmfkqnqS5xWQ6LJQzwr8trTf0lkkCB225EqRHxQjJV8h1hU1Fop6z443eH/Ck7AHUa02H/80lVA==; s=purelymail1; d=spwhitton.name; v=1; bh=ZCSRTA3UZdNRqwN5UIivj03uwyn38i6GX+H64wVq90c=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=FlMOrjl9eldAkYHO7+Icstq2DMsY3hKG0FfGptiYQz8ClMfjaiZ/7fzVlrFDxkNyDRAFPABxs6sBJo+NX4Ckn5810bx6aT3I/8y3/79nuAjeSwqIOaUBH6Aws//8sDeltfmln6K5YM83velEeKWJ0ntGyGSRh2I5LeOLjlv0Mhe+Q4jaondPjKA0a/Zx2eyT5aSzppGg6xgIyKsHttBTTugnhxQBZVXsi0fM8R8O/qbC56xCtwEf8ZdnhdE78V7pYGpKk+kQoMS88OU/NFBpcjzdz0lz8fkfzXzzDZjFHKLXMv1LtHNAvJnADN6f0A5h2clobrTPRRE8CnHcDUz4kg==; s=purelymail1; d=purelymail.com; v=1; bh=ZCSRTA3UZdNRqwN5UIivj03uwyn38i6GX+H64wVq90c=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 69097@debbugs.gnu.org Original-Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -1203110684; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 06 Sep 2024 11:06:22 +0000 (UTC) Original-Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 5AEC09417C1; Fri, 6 Sep 2024 12:06:21 +0100 (BST) In-Reply-To: <877cbpvzkm.fsf@zephyr.silentflame.com> (Sean Whitton's message of "Fri, 06 Sep 2024 11:36:25 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291307 Archived-At: Hello, On Fri 06 Sep 2024 at 11:36am +01, Sean Whitton wrote: > diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi > index 37cfe264157..b576df82382 100644 > --- a/doc/lispref/positions.texi > +++ b/doc/lispref/positions.texi > @@ -275,6 +275,19 @@ Word Motion > syntax tables. > @end defun > > +@deffn Command forward-unix-word &optional arg delim > +This function is like @code{forward-word}, except that words are always > +delimited by whitespace, regardless of the buffer's syntax table. This > +emulates how @kbd{C-w} at the Unix terminal or shell identifies words. > +See the @code{unix-word-rubout} command in @xref{(readline)Commands For > +Killing}. > + > +Lisp programs can pass the @var{delim} argument to specify the notion of > +whitespace. This argument is a string listing the characters considered > +whitespace, as might be passed to @code{skip-chars-forward}. The > +default is @code{[:space:]\n}. Do not prefix a `^' character. > +@end deffn The `^' should use @code{}. > diff --git a/lisp/simple.el b/lisp/simple.el > index 2453a129d0a..f34eef9ac25 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -8892,6 +8892,36 @@ current-word > ;; If we found something nonempty, return it as a string. > (unless (= start end) > (buffer-substring-no-properties start end))))) > + > +(defun forward-unix-word (&optional arg delim) > + "Move forward to the end of the next whitespace-delimited word. ARG is not optional, only DELIM, in fact. I will fix this. I thought I should also explain this DELIM thing. In addition to Philip's usage and unix-word-rubout, I would like to add unix-filename-rubout, which I think is generally useful -- it's also in (info "(readline)Commands For Killing"). DELIM is needed for that. It also makes the function more generally useful to Lisp programmers -- you might want to drop \n, for example. -- Sean Whitton