Subject: bug#7778: 24.0.50; just-one-space fails when optional argument is not provided

From: Tassilo Horn <[email-masked]>
Date: Mon, 03 Jan 2011 22:43:57 +0100

Dustin Sallings <[email-masked]> writes:

Hi Dustin,

> Any invocation of (just-one-space) without providing a numeric
> argument.

I think, I've already fixed that on the trunk with the bzr commit

  102603: Tassilo Horn 2010-12-07 * simple.el (just-one-space)

That was the diff.

--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2010-12-07 15:36:08 +0000
+++ lisp/ChangeLog	2010-12-07 19:38:38 +0000
@@ -1,3 +1,8 @@
+2010-12-07  Tassilo Horn  <[email-masked]>
+
+	* simple.el (just-one-space): Make argument n default to 1 if
+	omitted.
+
 2010-12-07  Stefan Monnier  <[email-masked]>
 
 	* electric.el (electric-indent-post-self-insert-function):

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2010-12-06 18:21:42 +0000
+++ lisp/simple.el	2010-12-07 19:38:38 +0000
@@ -764,6 +764,7 @@
   "Delete all spaces and tabs around point, leaving one space (or N spaces).
 If N is negative, deletes carriage return and linefeed characters as well."
   (interactive "*p")
+  (unless n (setq n 1))
   (let ((orig-pos (point))
         (skip-characters (if (< n 0) " \t\n\r" " \t"))
         (n (abs n)))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo