diff options
| author | Miles Bader | 2000-12-12 01:20:55 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-12-12 01:20:55 +0000 |
| commit | 5ff4ba3ddfdff8ae7e5da87a7c48af1359570029 (patch) | |
| tree | 5886cb98fef2b53c3672131ae6898a788beea03f | |
| parent | 657706fa9447b5be387e966eea2a5293f7f109ac (diff) | |
| download | emacs-5ff4ba3ddfdff8ae7e5da87a7c48af1359570029.tar.gz emacs-5ff4ba3ddfdff8ae7e5da87a7c48af1359570029.zip | |
(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'.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/simple.el | 29 |
2 files changed, 28 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3fdad5280c7..0c08f8745f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2000-12-12 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (delete-horizontal-space): Add BACKWARD-ONLY parameter. | ||
| 4 | Respect field end too. | ||
| 5 | (just-one-space): Respect fields as `delete-horizontal-space'. | ||
| 6 | (newline-and-indent, reindent-then-newline-and-indent): Use | ||
| 7 | `delete-horizontal-space'. | ||
| 8 | |||
| 1 | 2000-12-11 Stefan Monnier <monnier@cs.yale.edu> | 9 | 2000-12-11 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 10 | ||
| 3 | * newcomment.el (comment-indent-new-line): Use delete-horizontal-space | 11 | * newcomment.el (comment-indent-new-line): Use delete-horizontal-space |
diff --git a/lisp/simple.el b/lisp/simple.el index aded4e0650d..4fb7c03220f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -245,7 +245,7 @@ In programming language modes, this is the same as TAB. | |||
| 245 | In some text modes, where TAB inserts a tab, this command indents to the | 245 | In some text modes, where TAB inserts a tab, this command indents to the |
| 246 | column specified by the function `current-left-margin'." | 246 | column specified by the function `current-left-margin'." |
| 247 | (interactive "*") | 247 | (interactive "*") |
| 248 | (delete-region (point) (progn (skip-chars-backward " \t") (point))) | 248 | (delete-horizontal-space t) |
| 249 | (newline) | 249 | (newline) |
| 250 | (indent-according-to-mode)) | 250 | (indent-according-to-mode)) |
| 251 | 251 | ||
| @@ -258,7 +258,7 @@ In some text modes, where TAB inserts a tab, this indents to the | |||
| 258 | column specified by the function `current-left-margin'." | 258 | column specified by the function `current-left-margin'." |
| 259 | (interactive "*") | 259 | (interactive "*") |
| 260 | (save-excursion | 260 | (save-excursion |
| 261 | (delete-region (point) (progn (skip-chars-backward " \t") (point))) | 261 | (delete-horizontal-space t) |
| 262 | (indent-according-to-mode)) | 262 | (indent-according-to-mode)) |
| 263 | (newline) | 263 | (newline) |
| 264 | (indent-according-to-mode)) | 264 | (indent-according-to-mode)) |
| @@ -331,21 +331,32 @@ Leave one space or none, according to the context." | |||
| 331 | nil | 331 | nil |
| 332 | (insert ?\ )))) | 332 | (insert ?\ )))) |
| 333 | 333 | ||
| 334 | (defun delete-horizontal-space () | 334 | (defun delete-horizontal-space (&optional backward-only) |
| 335 | "Delete all spaces and tabs around point." | 335 | "Delete all spaces and tabs around point. |
| 336 | If BACKWARD-ONLY is non-nil, only delete spaces before point." | ||
| 336 | (interactive "*") | 337 | (interactive "*") |
| 337 | (skip-chars-backward " \t" (field-beginning)) | 338 | (delete-region |
| 338 | (delete-region (point) (progn (skip-chars-forward " \t") (point)))) | 339 | (if backward-only |
| 340 | (point) | ||
| 341 | (progn | ||
| 342 | (skip-chars-forward " \t" (field-end)) | ||
| 343 | (point))) | ||
| 344 | (progn | ||
| 345 | (skip-chars-backward " \t" (field-beginning nil t)) | ||
| 346 | (point)))) | ||
| 339 | 347 | ||
| 340 | (defun just-one-space () | 348 | (defun just-one-space () |
| 341 | "Delete all spaces and tabs around point, leaving one space." | 349 | "Delete all spaces and tabs around point, leaving one space." |
| 342 | (interactive "*") | 350 | (interactive "*") |
| 343 | (skip-chars-backward " \t") | 351 | (skip-chars-backward " \t" (field-beginning)) |
| 344 | (if (= (following-char) ? ) | 352 | (if (= (following-char) ? ) |
| 345 | (forward-char 1) | 353 | (forward-char 1) |
| 346 | (insert ? )) | 354 | (insert ? )) |
| 347 | (delete-region (point) (progn (skip-chars-forward " \t") (point)))) | 355 | (delete-region |
| 348 | 356 | (point) | |
| 357 | (progn | ||
| 358 | (skip-chars-forward " \t" (field-end nil t)) | ||
| 359 | (point)))) | ||
| 349 | 360 | ||
| 350 | (defun beginning-of-buffer (&optional arg) | 361 | (defun beginning-of-buffer (&optional arg) |
| 351 | "Move point to the beginning of the buffer; leave mark at previous position. | 362 | "Move point to the beginning of the buffer; leave mark at previous position. |