From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#69097: [PATCH] Add 'kill-region-or-word' command Date: Wed, 18 Sep 2024 19:08:35 +0300 Organization: LINKOV.NET Message-ID: <86plp1osfw.fsf@mail.linkov.net> References: <871q9g8z8k.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> <86frqd10k1.fsf@gnu.org> <87r09wvqdp.fsf@zephyr.silentflame.com> <86frqbyemw.fsf@gnu.org> <871q1vuq7y.fsf@zephyr.silentflame.com> <87wmjntb7x.fsf@zephyr.silentflame.com> <87h6aosofr.fsf@zephyr.silentflame.com> <87bk0wmy17.fsf@posteo.net> <86plp6ha3y.fsf@gnu.org> <87r09m8ogh.fsf@zephyr.silentflame.com> <87ttei2w2o.fsf@posteo.net> <86seu2fi07.fsf@gnu.org> <87plp62uj1.fsf@posteo.net> <86v7yuupqo.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22968"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 69097@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 18 18:09:55 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 1sqxFb-0005nP-Bu for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Sep 2024 18:09:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqxFW-0000Nj-KB; Wed, 18 Sep 2024 12:09:50 -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 1sqxFU-0000Na-4G for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 12:09:48 -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 1sqxFS-0002ub-Ra for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 12:09:47 -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=PHwQPxP4l+xP4pif/UOz4YVQ8u6CJt4yzv2E+eaQ54A=; b=X8c+wefbMTr5Id/qfOm+Fu+pz6Nqk3pslHcyWklIyyyvcDYX8rs9p/FjysZ0xhplhaXllKAY1hkx82c4wki+7oSNzlKOLn78Vq+0UeM1b1NzZ+59AozquTrnyEZQ437x6Q3BA7j4hPOsPUwhBGHoKl+mrHEtulSLullhgY4P2CT7foAbZtRk87r3VmAvbAbZnuc2aMK1/dFGXAbGNGBIFe9d/+ri5UeNZ6xsXHxrUNU8fU5F4R9APW9Llh+ip8tN552Drh+hRL/OGQZtcu9iGlxuY3VN///qsonn3L70f08VMAMERI3pbiXyIOQEwuJrF2Sv5f84Qo7R/1eIJdS+fQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqxFi-0005Gd-2k for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2024 12:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Sep 2024 16:10: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.172667578220210 (code B ref 69097); Wed, 18 Sep 2024 16:10:02 +0000 Original-Received: (at 69097) by debbugs.gnu.org; 18 Sep 2024 16:09:42 +0000 Original-Received: from localhost ([127.0.0.1]:59185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqxFO-0005Ft-4X for submit@debbugs.gnu.org; Wed, 18 Sep 2024 12:09:42 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:49675) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqxFL-0005Fb-DD for 69097@debbugs.gnu.org; Wed, 18 Sep 2024 12:09:40 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 6DBA560002; Wed, 18 Sep 2024 16:09:14 +0000 (UTC) In-Reply-To: <86v7yuupqo.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 17 Sep 2024 20:58:07 +0300") X-GND-Sasl: juri@linkov.net 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:292012 Archived-At: > Thanks for the new command! Sorry, I meant the new option. > I'd like to use it, but currently can't > because I have customized 'mark-even-if-inactive' to nil. This small fix addresses the remaining issues: diff --git a/lisp/simple.el b/lisp/simple.el index 9fbd9bfb577..40266f37209 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5865,7 +5865,7 @@ kill-region ;; Pass mark first, then point, because the order matters when ;; calling `kill-append'. (interactive (progn - (let ((beg (mark)) + (let ((beg (mark kill-region-dwim)) (end (point))) (cond ((and kill-region-dwim (not (use-region-p))) @@ -5888,10 +5888,12 @@ kill-region ((filter-buffer-substring beg end 'delete))))) (when string ;STRING is nil if BEG = END ;; Add that string to the kill ring, one way or another. - (if (eq last-command 'kill-region) + (if (and (null kill-region-dwim) + (eq last-command 'kill-region)) (kill-append string (< end beg)) (kill-new string))) - (when (or string (eq last-command 'kill-region)) + (when (and (null kill-region-dwim) + (or string (eq last-command 'kill-region))) (setq this-command 'kill-region)) (setq deactivate-mark t) nil)