+2000-12-12 Miles Bader <miles@gnu.org>
+
+ * simple.el (delete-horizontal-space): Add BACKWARD-ONLY parameter.
+ Respect field end too.
+ (just-one-space): Respect fields as `delete-horizontal-space'.
+ (newline-and-indent, reindent-then-newline-and-indent): Use
+ `delete-horizontal-space'.
+
2000-12-11 Stefan Monnier <monnier@cs.yale.edu>
* newcomment.el (comment-indent-new-line): Use delete-horizontal-space
In some text modes, where TAB inserts a tab, this command indents to the
column specified by the function `current-left-margin'."
(interactive "*")
- (delete-region (point) (progn (skip-chars-backward " \t") (point)))
+ (delete-horizontal-space t)
(newline)
(indent-according-to-mode))
column specified by the function `current-left-margin'."
(interactive "*")
(save-excursion
- (delete-region (point) (progn (skip-chars-backward " \t") (point)))
+ (delete-horizontal-space t)
(indent-according-to-mode))
(newline)
(indent-according-to-mode))
nil
(insert ?\ ))))
-(defun delete-horizontal-space ()
- "Delete all spaces and tabs around point."
+(defun delete-horizontal-space (&optional backward-only)
+ "Delete all spaces and tabs around point.
+If BACKWARD-ONLY is non-nil, only delete spaces before point."
(interactive "*")
- (skip-chars-backward " \t" (field-beginning))
- (delete-region (point) (progn (skip-chars-forward " \t") (point))))
+ (delete-region
+ (if backward-only
+ (point)
+ (progn
+ (skip-chars-forward " \t" (field-end))
+ (point)))
+ (progn
+ (skip-chars-backward " \t" (field-beginning nil t))
+ (point))))
(defun just-one-space ()
"Delete all spaces and tabs around point, leaving one space."
(interactive "*")
- (skip-chars-backward " \t")
+ (skip-chars-backward " \t" (field-beginning))
(if (= (following-char) ? )
(forward-char 1)
(insert ? ))
- (delete-region (point) (progn (skip-chars-forward " \t") (point))))
-
+ (delete-region
+ (point)
+ (progn
+ (skip-chars-forward " \t" (field-end nil t))
+ (point))))
(defun beginning-of-buffer (&optional arg)
"Move point to the beginning of the buffer; leave mark at previous position.