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 16:45:44 +0200
User-agent: mu4e 1.7.19; emacs 29.0.50

Lars Ingebrigtsen <larsi@gnus.org> writes:

Hi Lars,

>> Which is why we should change the default binding of M-SPC to
>> cycle-spacing. I know some people will complain, but all they have to
>> do is not type M-SPC twice. In short: Iʼm with Tassilo, letʼs be
>> disruptive.
>
> Thinking about it a bit more, I agree with you two.

I'll print that statement and put it in a frame in my living room. ;-)

> It'd be minimally disruptive, anyway -- nobody is likely to have a
> work flow that depends on hitting `M-SPC' many times in a row, because
> a second invocation of `just-one-space' does nothing.

Oh, indeed!

> So I think we should rebind `M-SPC' to `cycle-spacing', and allow
> customizations of the cycles.

Perfect.  If you are not already implementing that, I'd give it a shot
when I find some spare time.

BTW, do we already have a function which given an element and a
(conceptually cyclic) list returns the element after that.  E.g., such
as this one:

--8<---------------cut here---------------start------------->8---
(defun th/seq-element-after (elt list)
  (let ((l list))
    (catch 'found
      (while l
        (cond
         ((null (cdr l))
          (throw 'found
                 (when (eq elt (car l))
                   (car list))))
         ((and (eq elt (car l))
               (cdr l))
          (throw 'found (cadr l)))
         (t (setq l (cdr l))))))))

(setq th/test-list '(a b c))
(th/seq-element-after 'a th/test-list) ;=> b
(th/seq-element-after 'b th/test-list) ;=> c
(th/seq-element-after 'c th/test-list) ;=> a
(th/seq-element-after 'x th/test-list) ;=> nil
--8<---------------cut here---------------end--------------->8---

We need such a helper for the functionality.  The question is just if
it's generally useful in which case I'd ask for a good name and place
(accessible from simple.el).  Otherwise, I'd just keep it as an
anonymous helper...

Bye,
Tassilo





reply via email to

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