]> git.eshelyaron.com Git - emacs.git/commitdiff
(delete-horizontal-space): Add BACKWARD-ONLY parameter.
authorMiles Bader <miles@gnu.org>
Tue, 12 Dec 2000 01:20:55 +0000 (01:20 +0000)
committerMiles Bader <miles@gnu.org>
Tue, 12 Dec 2000 01:20:55 +0000 (01:20 +0000)
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'.

lisp/ChangeLog
lisp/simple.el

index 3fdad5280c79806fd6c389a92d877c2af09720fa..0c08f8745f9892abb97511155845670ac817e4c9 100644 (file)
@@ -1,3 +1,11 @@
+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
index aded4e0650dbf1a2644f513f949dcb52c5de0223..4fb7c03220fcf09db0f9e29459f4c6b492795df0 100644 (file)
@@ -245,7 +245,7 @@ In programming language modes, this is the same as TAB.
 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))
 
@@ -258,7 +258,7 @@ In some text modes, where TAB inserts a tab, this indents to the
 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))
@@ -331,21 +331,32 @@ Leave one space or none, according to the context."
        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.