Subject: [PATCH] * lisp/bindings.el: create binding for ‘cycle-spacing’
From: Michal Nazarewicz <[email-masked]>
To: [email-masked]
Cc: Glenn Morris <[email-masked]>, David Kastrup <[email-masked]>, Richard Stallman <[email-masked]>,Johan Bockgård <[email-masked]>, Tassilo Horn <[email-masked]>, Alan Mackenzie <[email-masked]>, Eli Zaretskii <[email-masked]>, Teemu Likonen <[email-masked]>
Date: Fri, 17 Jun 2016 22:12:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

‘cycle-spacing’ behaves like ‘just-one-space’ when invoked once so
binding it to M-SPC should not be (very) destructive to users.

When this change has been propesed back in 2014¹, the main concern
was that back then the function behaved a bit differently from the
old one in certain situations.  This has since been changed by a
[687e0e1: “Make ‘cycle-spacing’ behave more like ‘just-one-space’
if colled once.”] commit.

¹ https://lists.gnu.org/archive/html/emacs-devel/2014-01/msg02183.html
---
 etc/NEWS         | 6 ++++++
 lisp/bindings.el | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

 Unless there are objections, I’ll submit this in a week.  I’ve CC’d
 everyone who was involved in the original thread.

diff --git a/etc/NEWS b/etc/NEWS
index d8583cf..1041239 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -187,6 +187,12 @@ questions, with a handy way to display help texts.
 'undo', undo the last replacement; bound to 'u'.
 'undo-all', undo all replacements; bound to 'U'.
 
+** M-SPC is now bound to 'cycle-spacing'.
+When called once, 'cycle-spacing' behaves the same way
+'just-one-space' does so this change should not disturb any old
+habits.  When pressed multiple times it manipulate whitespace around
+point in a smart way giving user more editing powers.
+
 
 * Changes in Specialized Modes and Packages in Emacs 25.2
 
diff --git a/lisp/bindings.el b/lisp/bindings.el
index c13f4b1..cf9aaf3 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -807,7 +807,7 @@ esc-map
 (define-key esc-map "\\" 'delete-horizontal-space)
 (define-key esc-map "m" 'back-to-indentation)
 (define-key ctl-x-map "\C-o" 'delete-blank-lines)
-(define-key esc-map " " 'just-one-space)
+(define-key esc-map " " 'cycle-spacing)
 (define-key esc-map "z" 'zap-to-char)
 (define-key esc-map "=" 'count-words-region)
 (define-key ctl-x-map "=" 'what-cursor-position)
-- 
2.8.0.rc3.226.g39d4020