diff options
| author | Paul Eggert | 2011-07-13 23:41:47 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-13 23:41:47 -0700 |
| commit | cf950e6bbdeec3f6aab3e119f26f9cd5d962ac2e (patch) | |
| tree | 1bdb0fd052770b8c3b0c6ea83fb7c6a9bfdd5b85 /lisp/tabify.el | |
| parent | ca4aa9359160557f8103639fc3c0ccb16c6ba8d2 (diff) | |
| parent | 27fa387ad10e6a5639de1ab08e7559c06e9d802d (diff) | |
| download | emacs-cf950e6bbdeec3f6aab3e119f26f9cd5d962ac2e.tar.gz emacs-cf950e6bbdeec3f6aab3e119f26f9cd5d962ac2e.zip | |
Merge from trunk.
Diffstat (limited to 'lisp/tabify.el')
| -rw-r--r-- | lisp/tabify.el | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/tabify.el b/lisp/tabify.el index da1038a2164..0b2411d0316 100644 --- a/lisp/tabify.el +++ b/lisp/tabify.el | |||
| @@ -34,19 +34,21 @@ Called non-interactively, the region is specified by arguments | |||
| 34 | START and END, rather than by the position of point and mark. | 34 | START and END, rather than by the position of point and mark. |
| 35 | The variable `tab-width' controls the spacing of tab stops." | 35 | The variable `tab-width' controls the spacing of tab stops." |
| 36 | (interactive "r") | 36 | (interactive "r") |
| 37 | (save-excursion | 37 | (let ((c (current-column))) |
| 38 | (save-restriction | 38 | (save-excursion |
| 39 | (narrow-to-region (point-min) end) | 39 | (save-restriction |
| 40 | (goto-char start) | 40 | (narrow-to-region (point-min) end) |
| 41 | (while (search-forward "\t" nil t) ; faster than re-search | 41 | (goto-char start) |
| 42 | (forward-char -1) | 42 | (while (search-forward "\t" nil t) ; faster than re-search |
| 43 | (let ((tab-beg (point)) | 43 | (forward-char -1) |
| 44 | (indent-tabs-mode nil) | 44 | (let ((tab-beg (point)) |
| 45 | column) | 45 | (indent-tabs-mode nil) |
| 46 | (skip-chars-forward "\t") | 46 | column) |
| 47 | (setq column (current-column)) | 47 | (skip-chars-forward "\t") |
| 48 | (delete-region tab-beg (point)) | 48 | (setq column (current-column)) |
| 49 | (indent-to column)))))) | 49 | (delete-region tab-beg (point)) |
| 50 | (indent-to column))))) | ||
| 51 | (move-to-column c))) | ||
| 50 | 52 | ||
| 51 | (defvar tabify-regexp " [ \t]+" | 53 | (defvar tabify-regexp " [ \t]+" |
| 52 | "Regexp matching whitespace that tabify should consider. | 54 | "Regexp matching whitespace that tabify should consider. |