diff options
author | Deniz Dogan <deniz.a.m.dogan@gmail.com> | 2010-12-06 13:21:42 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-12-06 13:21:42 -0500 |
commit | 88b5a757a2ea698831c61bb10abc9c0abab7d31c (patch) | |
tree | 857d4cd8336061fc25ec099a43f44de2616b92dd /lisp/simple.el | |
parent | 3c2317e89100833812a7194c0d9d39ae0f52cb33 (diff) | |
download | emacs-88b5a757a2ea698831c61bb10abc9c0abab7d31c.tar.gz |
* lisp/simple.el (just-one-space): Delete newlines for negative arg.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 3b9bfc0519a..7300fb78a88 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -761,10 +761,13 @@ If BACKWARD-ONLY is non-nil, only delete them before point." (constrain-to-field nil orig-pos))))) (defun just-one-space (&optional n) - "Delete all spaces and tabs around point, leaving one space (or N spaces)." + "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") - (let ((orig-pos (point))) - (skip-chars-backward " \t") + (let ((orig-pos (point)) + (skip-characters (if (< n 0) " \t\n\r" " \t")) + (n (abs n))) + (skip-chars-backward skip-characters) (constrain-to-field nil orig-pos) (dotimes (i (or n 1)) (if (= (following-char) ?\s) @@ -773,7 +776,7 @@ If BACKWARD-ONLY is non-nil, only delete them before point." (delete-region (point) (progn - (skip-chars-forward " \t") + (skip-chars-forward skip-characters) (constrain-to-field nil orig-pos t))))) (defun beginning-of-buffer (&optional arg) |