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: Thu, 12 May 2022 06:53:58 +0200
User-agent: mu4e 1.7.19; emacs 29.0.50

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> I like the new `cycle-spacing' command but I frequently would like to
>> have an additional space where only the whitespace after point is
>> deleted.  That'd be useful when manually formatting text (code) where
>> auto-indentation isn't available.  My prime use-case is laying out
>> example code snippets in comments and docstrings which I copied &
>> pasted from somewhere else.  E.g., I start with a docstring
>>
>>   "Example:
>>
>>      (let [x :something]
>>        |                  (foo x)
>>                           (bar x))"
>>
>> where | is the position of point.  In that case, I'd like if M-SPC
>> would change the text to
>>
>>   "Example:
>>
>>      (let [x :something]
>>        |(foo x)
>>                           (bar x))"
>>
>> instead of
>>
>>   "Example:
>>
>>      (let [x :something]
>>  |(foo x)
>>                           (bar x))"
>>
>> i.e., it first M-SPC only deletes whitespace after point but not before.
>> I don't really care if that's the first state (although that would be
>> plausible, i.e., states are cycled from more space to less spaces), but
>> at least it should be a reachable state.
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> I think that sounds like a good feature -- we don't have any other
> commands for "delete all whitespace after point", do we?

No, just the opposite: delete-horizontal-space with prefix arg.

> We could implement this as a new third state for `cycle-spacing', and
> move the "restore" to the fourth state.  Does anybody think that will
> be annoying for people?

It makes the sequence longer in case you want to restore.  Not a big
thing IMHO.  But maybe there could also be a new defcustom
cycle-spacing-actions which lists the actions being cycled, e.g.,

  (just-one-space delete-all-space delete-space-after restore-original)

Bye,
Tassilo





reply via email to

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