bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19267: 25.0.50; Enhance cycle-spacing with a state where only whites


From: Tassilo Horn
Subject: bug#19267: 25.0.50; Enhance cycle-spacing with a state where only whitespace after point is deleted
Date: Sun, 15 May 2022 11:02:22 +0200
User-agent: mu4e 1.7.20; emacs 29.0.50

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> That's indeed an idea.  How about cycle-spacing-actions could also
>> have actions of the form
>>
>>     (just-one-space inverted-arg)
>>     (just-one-space 4)
>>
>> where the former would, you guess it, use the inverted value of this
>> cycle's prefix arg and the latter would ignore the cycle's prefix arg
>> and just use 4?  That would fit your desire, right?
>
> Sure, makes sense.  `inverted-arg' could be `-', even.

Ok, done, see attached patch.

>> Or do you suggest that cycle-spacing should be changed from taking a
>> numeric prefix arg to a raw prefix arg and then do the conversion to
>> numeric itself (with prefix-numeric-value)?
>
> Yes.

Also done.

>> In any case, how would you define the semantics for the delete-*
>> actions with numeric values for N?  I mean, for
>> delete-space-after/before I can imagine that the N whitespace
>> characters after/before should survive (in case there are at least so
>> many).  But in case of delete-all-space, there's no precise meaning
>> of the correct spaces around point which could be a wild mix of
>> spaces, tabs, and newlines.
>
> It's not meaningful for delete-all-space, but that's OK.

Ok, so now the N is considered for delete-space-after/before with the
meaning to keep N whitespace characters after/before point and only
delete surplus ones.  However, that has one major drawback: now you
cannot delete all whitespace including newlines before/after point
because that would require you to provide (zerop N) and (< N 0) at the
same time.

What do you think?  I mean, one solution would be to add just more
actions, e.g., rename the ones considering the actual numeric value of N
to delete-all-but-n-space-after/before (plus variants considering
newlines, too) and have delete-space-after/before as previously where
only N positive/negative is checked to control if newlines are
considered or not.

Bye,
Tassilo

Attachment: 0001-Improve-cycle-spacing.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]