comparison lisp/prim/tabify.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0132846995bd
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details. 17 ;; General Public License for more details.
18 18
19 ;; You should have received a copy of the GNU General Public License 19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free 20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
22 23
23 ;;; Synched up with: FSF 19.30. 24 ;;; Synched up with: FSF 19.34.
24 25
25 ;;; Commentary: 26 ;;; Commentary:
26 27
27 ;; Commands to optimize spaces to tabs or expand tabs to spaces in a region 28 ;; Commands to optimize spaces to tabs or expand tabs to spaces in a region
28 ;; (`tabify' and `untabify'). The variable tab-width does the obvious. 29 ;; (`tabify' and `untabify'). The variable tab-width does the obvious.
45 (let ((tab-beg (point)) 46 (let ((tab-beg (point))
46 (column (current-column)) 47 (column (current-column))
47 (indent-tabs-mode nil)) 48 (indent-tabs-mode nil))
48 (skip-chars-backward "\t" start) 49 (skip-chars-backward "\t" start)
49 (delete-region tab-beg (point)) 50 (delete-region tab-beg (point))
51 ;; XEmacs change -- show progress
50 (indent-to column) 52 (indent-to column)
51 (if (> (/ (* 100 (- (point) start)) (- (point-max) start)) percent) 53 (if (> (/ (* 100 (- (point) start)) (- (point-max) start)) percent)
52 (progn 54 (progn
53 (message "untabify: %d%% ..." percent) 55 (message "untabify: %d%% ..." percent)
54 (setq percent (+ 5 percent))))))) 56 (setq percent (+ 5 percent)))))))
74 (let ((percent 5)) 76 (let ((percent 5))
75 (while (re-search-forward "[ \t][ \t][ \t]*" nil t) 77 (while (re-search-forward "[ \t][ \t][ \t]*" nil t)
76 (let ((column (current-column)) 78 (let ((column (current-column))
77 (indent-tabs-mode t)) 79 (indent-tabs-mode t))
78 (delete-region (match-beginning 0) (point)) 80 (delete-region (match-beginning 0) (point))
81 ;; XEmacs change -- show progress
79 (indent-to column) 82 (indent-to column)
80 (if (> (/ (* 100 (- (point) start)) (- (point-max) start)) percent) 83 (if (> (/ (* 100 (- (point) start)) (- (point-max) start)) percent)
81 (progn 84 (progn
82 (message "tabify: %d%% ..." percent) 85 (message "tabify: %d%% ..." percent)
83 (setq percent (+ 5 percent))))))) 86 (setq percent (+ 5 percent)))))))