diff options
| author | Richard M. Stallman | 1994-06-23 23:57:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-06-23 23:57:33 +0000 |
| commit | fbf8f564cf07f3a53fd413243f41aecd700c54cb (patch) | |
| tree | 2005ac8b0c6cb313e33faae464ef12e3a519cda6 | |
| parent | 0b6ac150432b7b22bf4815ccda5b71ecbd27d3ce (diff) | |
| download | emacs-fbf8f564cf07f3a53fd413243f41aecd700c54cb.tar.gz emacs-fbf8f564cf07f3a53fd413243f41aecd700c54cb.zip | |
(move-to-tab-stop): Delete unnecessary spaces
before the old point if a tab followed or follows the old point.
| -rw-r--r-- | lisp/indent.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/indent.el b/lisp/indent.el index 2713be3b51f..ef63db81932 100644 --- a/lisp/indent.el +++ b/lisp/indent.el | |||
| @@ -260,6 +260,29 @@ Use \\[edit-tab-stops] to edit them interactively." | |||
| 260 | (delete-region (point) opoint))) | 260 | (delete-region (point) opoint))) |
| 261 | (move-to-column (car tabs) t))))) | 261 | (move-to-column (car tabs) t))))) |
| 262 | 262 | ||
| 263 | (defun move-to-tab-stop () | ||
| 264 | "Move point to next defined tab-stop column. | ||
| 265 | The variable `tab-stop-list' is a list of columns at which there are tab stops. | ||
| 266 | Use \\[edit-tab-stops] to edit them interactively." | ||
| 267 | (interactive) | ||
| 268 | (let ((tabs tab-stop-list)) | ||
| 269 | (while (and tabs (>= (current-column) (car tabs))) | ||
| 270 | (setq tabs (cdr tabs))) | ||
| 271 | (if tabs | ||
| 272 | (let ((before (point))) | ||
| 273 | (move-to-column (car tabs) t) | ||
| 274 | (save-excursion | ||
| 275 | (goto-char before) | ||
| 276 | ;; If we just added a tab, or moved over one, | ||
| 277 | ;; delete any superfluous spaces before the old point. | ||
| 278 | (if (and (eq (preceding-char) ?\ ) | ||
| 279 | (eq (following-char) ?\t)) | ||
| 280 | (let ((tabend (* (/ (current-column) tab-width) tab-width))) | ||
| 281 | (while (and (> (current-column) tabend) | ||
| 282 | (eq (preceding-char) ?\ )) | ||
| 283 | (forward-char -1)) | ||
| 284 | (delete-region (point) before)))))))) | ||
| 285 | |||
| 263 | (define-key global-map "\t" 'indent-for-tab-command) | 286 | (define-key global-map "\t" 'indent-for-tab-command) |
| 264 | (define-key esc-map "\034" 'indent-region) | 287 | (define-key esc-map "\034" 'indent-region) |
| 265 | (define-key ctl-x-map "\t" 'indent-rigidly) | 288 | (define-key ctl-x-map "\t" 'indent-rigidly) |