From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#19267: 25.0.50; Enhance cycle-spacing with a state where only whitespace after point is deleted Date: Fri, 13 May 2022 20:48:44 +0200 Message-ID: <8735hdfeby.fsf@gnu.org> References: <875ym94kw6.fsf@gmail.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="24399"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.20; emacs 29.0.50 Cc: Lars Ingebrigtsen , 19267@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 13 21:01:20 2022 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 1npaXP-0006E5-8D for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 21:01:19 +0200 Original-Received: from localhost ([::1]:38060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npaXO-0007YM-6Y for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 15:01:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npaX8-0007Xz-Vp for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 15:01:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npaX8-0006oI-Ji for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 15:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npaX8-00060S-97 for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 15:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 May 2022 19:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19267 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 19267-submit@debbugs.gnu.org id=B19267.165246843523032 (code B ref 19267); Fri, 13 May 2022 19:01:02 +0000 Original-Received: (at 19267) by debbugs.gnu.org; 13 May 2022 19:00:35 +0000 Original-Received: from localhost ([127.0.0.1]:45040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npaWg-0005zP-Mu for submit@debbugs.gnu.org; Fri, 13 May 2022 15:00:35 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npaWf-0005z3-6s for 19267@debbugs.gnu.org; Fri, 13 May 2022 15:00:33 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40158) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npaWY-0006kL-MK; Fri, 13 May 2022 15:00:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=NXcGp1Znt6H+kuCW5bPvboUL/oYezp8oWh7aF8c6MOk=; b=AN1nsE83NUibPw Fn8PU9O+KpwubnxKqF/PJEkJqKoo53c/MV/+fJRT8bHIywDaOvr5RO8c5jxkTeivaHw1jxqDzl3Tm RCC2fBoi3Nsh2J3HFTsDcNBRfeXQzbGuzE/PxGd8xsGkUha1wn5RMhRxRAHHk9dqOzPlmBgBjALPZ ZH7owJiJOfACYqkx9YDQrygRBifCobCTUj4sg7rHGjsLZ0Emhaq34aiJT7DEkUKtztcbd7UVLYgcK gu686Qw8RvUr1LHub1/q520ciuUWNZjOgOh9yQZISePvktpbNb28NxiPKX3y9T3U7GjfwL64NzY3u Owzs/uIx9LTOAp6tlhcQ==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:49297) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npaWC-0005cg-TA; Fri, 13 May 2022 15:00:23 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id 8ECAB27C005B; Fri, 13 May 2022 15:00:04 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 13 May 2022 15:00:04 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrgeelgdduvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvvefuffgjkfggtgesthdtredttdertdenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe dujedtheduvdelffejkeetgedvheelhedvueefhfeukeekkeehvdfggeegffevgfenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnod hmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedv leekqdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 May 2022 15:00:03 -0400 (EDT) In-reply-to: <875ym94kw6.fsf@gmail.com> 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" Xref: news.gmane.io gmane.emacs.bugs:232190 Archived-At: Robert Pluim writes: > Tassilo> Ok, attached is a first version of the patch for > Tassilo> discussion. The supported actions are: > > Tassilo> (setq cycle-spacing-actions > Tassilo> '( just-one-space ; you name it > Tassilo> ;; delete-space-after ; delete spaces after point > Tassilo> delete-space-before ; delete spaces before point > Tassilo> delete-all-space ; delete all spaces around point > Tassilo> restore)) ; restore the original spacing > > Can we add something to the description of `delete-all-space' (or > change the name) that makes it clear it deletes newlines as well? It doesn't generally. All those actions delete newlines only if a negative prefix arg is given. The delete-all-space action calls delete-horizontal-space with prefix arg >= 0 or delete-all-space with negative prefix arg. Ok, now I see that the action's name is the same as the command delete-all-space which I've also introduced and which does delete newlines. But an action delete-horizontal-or-all-space is a bit longish. I think it's ok as it is but will document that the term "space" may or may not include newlines. > Tassilo> In addition, you can add functions (symbols) into that list which are > Tassilo> simply funcall-ed. > > Tassilo> Here are some thoughts I'd like to discuss: > > Tassilo> 1. Currently as previously, changing the prefix arg will start a new > Tassilo> sequence, e.g., M-4 M-SPC M-8 M-SPC will call just-one-space twice > Tassilo> with 4 and then 8. I think that made sense when just-one-space was > Tassilo> guaranteed to be the first action ("Oh, I mistyped my prefix arg so > Tassilo> let's just correct that!"). > > Tassilo> However, with the new version, I think it would make more sense when > Tassilo> the prefix arg given to the initial invocation is passed on to > Tassilo> following invocations of this cycle. The reason is that only > Tassilo> just-one-space actually cares about the exact numerical value whereas > Tassilo> all actions (except 'restore) care about the prefix arg being > Tassilo> positive or negative. A negative arg always indicates that newlines > Tassilo> are treated as a deletable space whereas arg => 0 only considers tabs > Tassilo> and spaces. So right now, if you want to delete all space including > Tassilo> newlines, you have to type M-- M-SPC M-- M-SPC M-- M-SPC which is > Tassilo> inconvenient. If the initial arg was passed on, it would just be M-- > Tassilo> M-SPC M-SPC M-SPC which is much easier to type. > > I think that makes sense. You can always specify a prefix arg of a > different sign in subsequent invocations of M-SPC if you want. Exactly. > Tassilo> Of course, that comes with the (IMHO little) downside that you need > Tassilo> to do something else to break a cycle, e.g., C-g. That could be > Tassilo> fixed by starting a new cycle only if the prefix arg is not 1 (the > Tassilo> default). > > Would a motion command not suffice? Sure. But after a mistyped M-3 M-SPC with the intention to have "just 4 spaces", being able to do M-4 M-SPC is still one motion command shorter. ;-) Bye, Tassilo