Commit 9ab59a1a authored by Miles Bader's avatar Miles Bader
Browse files

(delete-horizontal-space, just-one-space): Use `constrain-to-field'

instead of `field-end'/`field-beginning', because it's more efficient
for large files.
parent f042e7b9
2001-05-18 Miles Bader <miles@gnu.org>
* simple.el (delete-horizontal-space, just-one-space): Use
`constrain-to-field' instead of `field-end'/`field-beginning',
because it's more efficient for large files.
2001-05-17 Gerd Moellmann <gerd@gnu.org> 2001-05-17 Gerd Moellmann <gerd@gnu.org>
   
* mail/rmail.el (rmail-require-mime-maybe): New function. * mail/rmail.el (rmail-require-mime-maybe): New function.
......
...@@ -340,28 +340,31 @@ Leave one space or none, according to the context." ...@@ -340,28 +340,31 @@ Leave one space or none, according to the context."
"Delete all spaces and tabs around point. "Delete all spaces and tabs around point.
If BACKWARD-ONLY is non-nil, only delete spaces before point." If BACKWARD-ONLY is non-nil, only delete spaces before point."
(interactive "*") (interactive "*")
(delete-region (let ((orig-pos (point)))
(if backward-only (delete-region
(point) (if backward-only
orig-pos
(progn
(skip-chars-forward " \t")
(constrain-to-field nil orig-pos t)))
(progn (progn
(skip-chars-forward " \t" (field-end)) (skip-chars-backward " \t")
(point))) (constrain-to-field nil orig-pos)))))
(progn
(skip-chars-backward " \t" (field-beginning nil t))
(point))))
(defun just-one-space () (defun just-one-space ()
"Delete all spaces and tabs around point, leaving one space." "Delete all spaces and tabs around point, leaving one space."
(interactive "*") (interactive "*")
(skip-chars-backward " \t" (field-beginning)) (let ((orig-pos (point)))
(if (= (following-char) ? ) (skip-chars-backward " \t")
(forward-char 1) (constrain-to-field nil orig-pos)
(insert ? )) (if (= (following-char) ? )
(delete-region (forward-char 1)
(point) (insert ? ))
(progn (delete-region
(skip-chars-forward " \t" (field-end nil t)) (point)
(point)))) (progn
(skip-chars-forward " \t")
(constrain-to-field nil orig-pos t)))))
(defun beginning-of-buffer (&optional arg) (defun beginning-of-buffer (&optional arg)
"Move point to the beginning of the buffer; leave mark at previous position. "Move point to the beginning of the buffer; leave mark at previous position.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment