[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple.el: fix just-one-space breaking change
From: |
Tim Van Holder |
Subject: |
simple.el: fix just-one-space breaking change |
Date: |
Mon, 17 Jan 2005 09:39:02 +0100 |
The change to just-one-space of January 15th was a breaking one.
It introduces a non-optional parameter, breaking all current
invocations (which do not specify a parameter), such as
cc-electric-brace.
The trivial patch below fixes this by making the new parameter optional.
Note that given the function's name, it may be better to make a
`just-n-spaces' defun, and let just-one-space call that -
"(just-one-space 17)" is not as clear as "(just-n-spaces 17)".
Index: simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.681
diff -u -u -p -d -r1.681 simple.el
--- simple.el 15 Jan 2005 18:08:46 -0000 1.681
+++ simple.el 17 Jan 2005 08:30:01 -0000
@@ -647,13 +647,13 @@ If BACKWARD-ONLY is non-nil, only delete
(skip-chars-backward " \t")
(constrain-to-field nil orig-pos)))))
-(defun just-one-space (n)
+(defun just-one-space (&optional n)
"Delete all spaces and tabs around point, leaving one space (or N spaces)."
(interactive "*p")
(let ((orig-pos (point)))
(skip-chars-backward " \t")
(constrain-to-field nil orig-pos)
- (dotimes (i n)
+ (dotimes (i (or n 1))
(if (= (following-char) ?\ )
(forward-char 1)
(insert ?\ )))
- simple.el: fix just-one-space breaking change,
Tim Van Holder <=