X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/6c96b8933b2c5b5c85d8fa0c3f77431f5dae2e27..30fcaf3a28e94241889bdd6e27ae759c4185ad74:/lisp/tabify.el diff --git a/lisp/tabify.el b/lisp/tabify.el index d0d65efcf9..0b2411d031 100644 --- a/lisp/tabify.el +++ b/lisp/tabify.el @@ -1,16 +1,16 @@ ;;; tabify.el --- tab conversion commands for Emacs -;; Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1994, 2001-2011 Free Software Foundation, Inc. ;; Maintainer: FSF +;; Package: emacs ;; This file is part of GNU Emacs. -;; GNU Emacs is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,9 +18,7 @@ ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -36,19 +34,21 @@ Called non-interactively, the region is specified by arguments START and END, rather than by the position of point and mark. The variable `tab-width' controls the spacing of tab stops." (interactive "r") - (save-excursion - (save-restriction - (narrow-to-region (point-min) end) - (goto-char start) - (while (search-forward "\t" nil t) ; faster than re-search - (forward-char -1) - (let ((tab-beg (point)) - (indent-tabs-mode nil) - column) - (skip-chars-forward "\t") - (setq column (current-column)) - (delete-region tab-beg (point)) - (indent-to column)))))) + (let ((c (current-column))) + (save-excursion + (save-restriction + (narrow-to-region (point-min) end) + (goto-char start) + (while (search-forward "\t" nil t) ; faster than re-search + (forward-char -1) + (let ((tab-beg (point)) + (indent-tabs-mode nil) + column) + (skip-chars-forward "\t") + (setq column (current-column)) + (delete-region tab-beg (point)) + (indent-to column))))) + (move-to-column c))) (defvar tabify-regexp " [ \t]+" "Regexp matching whitespace that tabify should consider. @@ -91,5 +91,4 @@ The variable `tab-width' controls the spacing of tab stops." (provide 'tabify) -;; arch-tag: c83893b1-e0cc-4e57-8a09-73fd03466416 ;;; tabify.el ends here