aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Meulien2013-06-18 10:17:01 +0200
committerJuanma Barranquero2013-06-18 10:17:01 +0200
commit9a08a6173c251e20bb8aeb7482ec7e429e863a4d (patch)
tree3abbf5af34ddf2b27cc18df16d117c5e74c332ff
parent9445f99bd69192de4a1d0f86f33410f4f7d64c4c (diff)
downloademacs-9a08a6173c251e20bb8aeb7482ec7e429e863a4d.tar.gz
emacs-9a08a6173c251e20bb8aeb7482ec7e429e863a4d.zip
lisp/tabify.el (untabify, tabify): With prefix, apply to entire buffer.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/tabify.el18
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 @@
12013-06-18 Matthias Meulien <orontee@gmail.com>
2
3 * tabify.el (untabify, tabify): With prefix, apply to entire buffer.
4
12013-06-18 Glenn Morris <rgm@gnu.org> 52013-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.
33If called interactively with prefix ARG, convert for the entire
34buffer.
35
33Called non-interactively, the region is specified by arguments 36Called non-interactively, the region is specified by arguments
34START and END, rather than by the position of point and mark. 37START and END, rather than by the position of point and mark.
35The variable `tab-width' controls the spacing of tab stops." 38The 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.
61A group of spaces is partially replaced by tabs 66A group of spaces is partially replaced by tabs
62when this can be done without changing the column they end at. 67when this can be done without changing the column they end at.
68If called interactively with prefix ARG, convert for the entire
69buffer.
70
63Called non-interactively, the region is specified by arguments 71Called non-interactively, the region is specified by arguments
64START and END, rather than by the position of point and mark. 72START and END, rather than by the position of point and mark.
65The variable `tab-width' controls the spacing of tab stops." 73The 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