all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Robert Pluim <rpluim@gmail.com>, 19267@debbugs.gnu.org
Subject: bug#19267: 25.0.50; Enhance cycle-spacing with a state where only whitespace after point is deleted
Date: Fri, 13 May 2022 21:01:07 +0200	[thread overview]
Message-ID: <87y1z5dz9w.fsf@gnu.org> (raw)
In-Reply-To: <87czghwroc.fsf@gnus.org>

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Ok, attached is a first version of the patch for discussion.  The
>> supported actions are:
>>
>> (setq cycle-spacing-actions
>>       '( just-one-space        ; you name it
>>          ;; delete-space-after ; delete spaces after point
>>          delete-space-before   ; delete spaces before point
>>          delete-all-space      ; delete all spaces around point
>>          restore))             ; restore the original spacing
>>
>> In addition, you can add functions (symbols) into that list which are
>> simply funcall-ed.
>
> Sounds good.  There should also be a just-one-space-including-newlines
> (which is the `M-- M-SPC' action), and...  Uhm, perhaps that's all
> that's missing, if we want to cover all the `M-SPC'/`M-\' actions.
>
> Or perhaps newline-including versions of all the functions, really.

I'll make it so that the prefix arg is passed on in the cycle so M--
M-SPC M-SPC will delete all space including newline before point.  IMO,
that's better than a separate action.

>>    However, with the new version, I think it would make more sense
>>    when the prefix arg given to the initial invocation is passed on
>>    to following invocations of this cycle.  The reason is that only
>>    just-one-space actually cares about the exact numerical value
>>    whereas all actions (except 'restore) care about the prefix arg
>>    being positive or negative.
>
> delete-space-before/after could also care about the numerical prefix?

Yes, in the sense that negative means "including newlines".

>>    A negative arg always indicates that newlines are treated as a
>>    deletable space whereas arg => 0 only considers tabs and spaces.
>>    So right now, if you want to delete all space including newlines,
>>    you have to type M-- M-SPC M-- M-SPC M-- M-SPC which is
>>    inconvenient.  If the initial arg was passed on, it would just be
>>    M-- M-SPC M-SPC M-SPC which is much easier to type.
>
> After typing `M-- M-SPC' once, further incantations of that doesn't do
> anything, does it?

Right now and with my patch, M-- M-SPC would call (just-one-space -1)
and the next M-SPC would start another cycle with (just-one-space 1)
because the prefix arg changed.

My suggestion is that M-- M-SPC M-SPC will call (just-one-space -1)
(delete-space-before -1) [ok, the latter is no function but you get the
idea].

Bye,
Tassilo





  parent reply	other threads:[~2022-05-13 19:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  8:06 bug#19267: 25.0.50; Enhance cycle-spacing with a state where only whitespace after point is deleted Tassilo Horn
2022-05-12  2:16 ` Lars Ingebrigtsen
2022-05-12  4:53   ` Tassilo Horn
2022-05-12 11:45     ` Lars Ingebrigtsen
2022-05-12 11:56       ` Tassilo Horn
2022-05-12 12:09         ` Lars Ingebrigtsen
2022-05-12 12:16           ` Robert Pluim
2022-05-12 12:21             ` Lars Ingebrigtsen
2022-05-12 14:45               ` Tassilo Horn
2022-05-13  8:50                 ` Tassilo Horn
2022-05-13 13:33                   ` Robert Pluim
2022-05-13 18:48                     ` Tassilo Horn
2022-05-13 12:19                 ` Lars Ingebrigtsen
2022-05-13 13:36                   ` Robert Pluim
2022-05-13 13:39                     ` Lars Ingebrigtsen
2022-05-13 19:01                   ` Tassilo Horn [this message]
2022-05-13 19:26                     ` Lars Ingebrigtsen
2022-05-13 21:11                       ` Tassilo Horn
2022-05-14  2:24                         ` Lars Ingebrigtsen
2022-05-14  6:54                           ` Tassilo Horn
2022-05-14 15:51                             ` Lars Ingebrigtsen
2022-05-15  9:02                               ` Tassilo Horn
2022-05-15 12:27                                 ` Lars Ingebrigtsen
2022-05-15 19:04                                   ` Tassilo Horn
2022-05-16  1:05                                     ` Lars Ingebrigtsen
2022-05-16  8:05                                       ` Tassilo Horn
2022-05-16 12:19                                         ` Lars Ingebrigtsen
2022-05-16 12:28                                           ` Tassilo Horn
2022-05-16 12:32                                             ` Lars Ingebrigtsen
2022-05-16 13:04                                               ` Tassilo Horn
2022-05-17 15:42                                                 ` Robert Pluim
2022-05-17 15:55                                                   ` Robert Pluim
2022-05-17 15:57                                                     ` Tassilo Horn
2022-05-17 16:12                                                       ` Robert Pluim
2022-05-16  7:33                                     ` Robert Pluim
2022-05-12 12:20           ` Tassilo Horn
2022-05-12  5:40   ` Eli Zaretskii
2022-05-12  5:46     ` Tassilo Horn
2022-05-12  8:25     ` Robert Pluim
2022-05-12  8:29       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1z5dz9w.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=19267@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.