[Top][All Lists]

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

Re: key-binding for cycle-spacing

From: Michal Nazarewicz
Subject: Re: key-binding for cycle-spacing
Date: Mon, 10 Feb 2014 14:45:03 +0100
User-agent: Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Emacs/ (x86_64-unknown-linux-gnu)

On Wed, Jan 29 2014, Alan Mackenzie wrote:
> Also, why do we need this function?  Surely somebody adjusting her
> whitespace at some place will know in advance whether she wants:
> (a) 1 space;
> (b) n spaces;
> (c) no space,
> and cycling through the possibilities to get there is an inefficient
> waste of time.

Albeit no.  I'm using `cycle-spacing' with the following binding:

    (define-key esc-map " "
                (lambda (n) (interactive "*p")
                  (cycle-spacing (- n) t)))

and I sometimes end up with a situation like this one:

    const unsigned long long foo =-!-
        calculate_stuff() * calculate_other_stuff();

(-!- denoting point) in which case I don't know if I want 1 space or
whatever there is now.  What I end up doing is hit M-SPC to end up with:

    const unsigned long long foo = calculate_stuff() * calculate_other_stuff();

and if it fits in my window (which is 80-character wide) I go on with my
life, if it does not, I press M-SPC two more times.

(And before you ask, yes, I am aware of M-^ and C-_ but see below.)

> There are already suitable commands and bindings for them to do each of
> the things done by `cycle-spacing', namely M-SPC, C-u n M-space, M-\,
> and C-_.

Sure, but:
* It is *much* easier to press the same key sequence three times in
  a row than to use different key sequences.  Compare:
    - hold ALT down
    - press SPACE
    - press SPACE
    - press SPACE
    - release ALT
    - hold ALT down
    - press SPACE
    - press \  (which in many keyboard layouts is on far right which
                forces you to extend your pinky)
    - release ALT
    - hold SHIFT and CTRL down
    - press _
    - release SHIFT and CTRL
* I find it easier to remember one key sequence that does magic stuff
  then to remember bindings for everything.  I never use M-\ and don't
  have to remember it's there because M-SPC almost always does what
  I want it to do if I press it enough times.

  Similarly, I have no idea what is the key binding is for going back to
  indention or to the beginning of buffer since my C-a does all that for

BTW. M-\ does not work on new line characters whereas `cycle-spacing'

> I don't thing we need this function.  I can't see a use case.

Hope the above helps.

Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<address@hidden>--<xmpp:address@hidden>--ooO--(_)--Ooo--

Attachment: signature.asc
Description: PGP signature

reply via email to

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