Commit bead9a43 authored by Juanma Barranquero's avatar Juanma Barranquero Committed by Lars Magne Ingebrigtsen
Browse files

Preserve point when doing untabify

* tabify.el (untabify): Preserve the current column so that point
doesn't move.

Fixes: debbugs:6032
parent 90a6258b
2011-07-13 Juanma Barranquero <lekktu@gmail.com>
* tabify.el (untabify): Preserve the current column so that point
doesn't move (bug#6032).
2011-07-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
* progmodes/cperl-mode.el (cperl-syntaxify-by-font-lock): Rewrite
......
......@@ -34,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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment