diff options
| author | Matthias Meulien | 2013-06-18 10:17:01 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2013-06-18 10:17:01 +0200 |
| commit | 9a08a6173c251e20bb8aeb7482ec7e429e863a4d (patch) | |
| tree | 3abbf5af34ddf2b27cc18df16d117c5e74c332ff | |
| parent | 9445f99bd69192de4a1d0f86f33410f4f7d64c4c (diff) | |
| download | emacs-9a08a6173c251e20bb8aeb7482ec7e429e863a4d.tar.gz emacs-9a08a6173c251e20bb8aeb7482ec7e429e863a4d.zip | |
lisp/tabify.el (untabify, tabify): With prefix, apply to entire buffer.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/tabify.el | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab8868d600c..bcfb24f0d19 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-06-18 Matthias Meulien <orontee@gmail.com> | ||
| 2 | |||
| 3 | * tabify.el (untabify, tabify): With prefix, apply to entire buffer. | ||
| 4 | |||
| 1 | 2013-06-18 Glenn Morris <rgm@gnu.org> | 5 | 2013-06-18 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * generic-x.el (bat-generic-mode, rc-generic-mode, rul-generic-mode): | 7 | * generic-x.el (bat-generic-mode, rc-generic-mode, rul-generic-mode): |
diff --git a/lisp/tabify.el b/lisp/tabify.el index 6bf45b36886..a90bf801bcf 100644 --- a/lisp/tabify.el +++ b/lisp/tabify.el | |||
| @@ -28,12 +28,17 @@ | |||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | ;;;###autoload | 30 | ;;;###autoload |
| 31 | (defun untabify (start end) | 31 | (defun untabify (start end &optional arg) |
| 32 | "Convert all tabs in region to multiple spaces, preserving columns. | 32 | "Convert all tabs in region to multiple spaces, preserving columns. |
| 33 | If called interactively with prefix ARG, convert for the entire | ||
| 34 | buffer. | ||
| 35 | |||
| 33 | Called non-interactively, the region is specified by arguments | 36 | Called non-interactively, the region is specified by arguments |
| 34 | START and END, rather than by the position of point and mark. | 37 | START and END, rather than by the position of point and mark. |
| 35 | The variable `tab-width' controls the spacing of tab stops." | 38 | The variable `tab-width' controls the spacing of tab stops." |
| 36 | (interactive "r") | 39 | (interactive (if current-prefix-arg |
| 40 | (list (point-min) (point-max) current-prefix-arg) | ||
| 41 | (list (region-beginning) (region-end) nil))) | ||
| 37 | (let ((c (current-column))) | 42 | (let ((c (current-column))) |
| 38 | (save-excursion | 43 | (save-excursion |
| 39 | (save-restriction | 44 | (save-restriction |
| @@ -56,14 +61,19 @@ Usually this will be \" [ \\t]+\" to match a space followed by whitespace. | |||
| 56 | \"^\\t* [ \\t]+\" is also useful, for tabifying only initial whitespace.") | 61 | \"^\\t* [ \\t]+\" is also useful, for tabifying only initial whitespace.") |
| 57 | 62 | ||
| 58 | ;;;###autoload | 63 | ;;;###autoload |
| 59 | (defun tabify (start end) | 64 | (defun tabify (start end &optional arg) |
| 60 | "Convert multiple spaces in region to tabs when possible. | 65 | "Convert multiple spaces in region to tabs when possible. |
| 61 | A group of spaces is partially replaced by tabs | 66 | A group of spaces is partially replaced by tabs |
| 62 | when this can be done without changing the column they end at. | 67 | when this can be done without changing the column they end at. |
| 68 | If called interactively with prefix ARG, convert for the entire | ||
| 69 | buffer. | ||
| 70 | |||
| 63 | Called non-interactively, the region is specified by arguments | 71 | Called non-interactively, the region is specified by arguments |
| 64 | START and END, rather than by the position of point and mark. | 72 | START and END, rather than by the position of point and mark. |
| 65 | The variable `tab-width' controls the spacing of tab stops." | 73 | The variable `tab-width' controls the spacing of tab stops." |
| 66 | (interactive "r") | 74 | (interactive (if current-prefix-arg |
| 75 | (list (point-min) (point-max) current-prefix-arg) | ||
| 76 | (list (region-beginning) (region-end) nil))) | ||
| 67 | (save-excursion | 77 | (save-excursion |
| 68 | (save-restriction | 78 | (save-restriction |
| 69 | ;; Include the beginning of the line in the narrowing | 79 | ;; Include the beginning of the line in the narrowing |