Index: lisp/tabify.el =================================================================== RCS file: /sources/emacs/emacs/lisp/tabify.el,v retrieving revision 1.19 diff -c -r1.19 tabify.el *** lisp/tabify.el 6 Feb 2006 14:33:35 -0000 1.19 --- lisp/tabify.el 25 Jul 2006 10:30:09 -0000 *************** *** 50,59 **** (delete-region tab-beg (point)) (indent-to column)))))) ! (defvar tabify-regexp "[ \t][ \t]+" "Regexp matching whitespace that tabify should consider. ! Usually this will be \"[ \\t][ \\t]+\" to match two or more spaces or tabs. ! \"^[ \\t]+\" is also useful, for tabifying only initial whitespace.") ;;;###autoload (defun tabify (start end) --- 50,60 ---- (delete-region tab-beg (point)) (indent-to column)))))) ! (defvar tabify-regexp " [ \t]+" "Regexp matching whitespace that tabify should consider. ! Usually this will be \" [ \\t]+\" to match two or more spaces or tabs. ! \"^\\\\( \\t*\\\\)+\" is also useful, for tabifying only initial whitespace. ! Note that if a `\\t' is matched, a space must have been matched before.") ;;;###autoload (defun tabify (start end) *************** *** 75,82 **** (while (re-search-forward tabify-regexp nil t) (let ((column (current-column)) (indent-tabs-mode t)) ! (delete-region (match-beginning 0) (point)) ! (indent-to column)))))) (provide 'tabify) --- 76,94 ---- (while (re-search-forward tabify-regexp nil t) (let ((column (current-column)) (indent-tabs-mode t)) ! (unless (save-excursion ! (if (not (= (skip-chars-backward " " (match-beginning 0)) ! (- (match-beginning 0) (match-end 0)))) ! ;; There is a TAB after a space: (match-string 0) is ! ;; not full of spaces. ! nil ! ;; See if there's room for a TAB. ! ;; We already are at (match-beginning 0). ! (< (+ (mod (current-column) tab-width) ! (- column (current-column))) ! tab-width))) ! (delete-region (match-beginning 0) (point)) ! (indent-to column))))))) (provide 'tabify) Index: lisp/ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.9820 diff -c -r1.9820 ChangeLog *** lisp/ChangeLog 17 Jul 2006 04:07:48 -0000 1.9820 --- lisp/ChangeLog 25 Jul 2006 10:30:10 -0000 *************** *** 1,3 **** --- 1,7 ---- + 2006-07-24 Michaël Cadilhac + + * tabify.el (tabify): Check if not already tabified before indenting. + 2006-07-17 Chong Yidong * progmodes/compile.el (compilation-mode-font-lock-keywords):