[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r105173: Preserve point when doing un
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r105173: Preserve point when doing untabify |
Date: |
Wed, 13 Jul 2011 20:12:05 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 105173
fixes bug(s): http://debbugs.gnu.org/6032
author: Juanma Barranquero <address@hidden>
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2011-07-13 20:12:05 +0200
message:
Preserve point when doing untabify
* tabify.el (untabify): Preserve the current column so that point
doesn't move.
modified:
lisp/ChangeLog
lisp/tabify.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-07-13 17:47:17 +0000
+++ b/lisp/ChangeLog 2011-07-13 18:12:05 +0000
@@ -1,3 +1,8 @@
+2011-07-13 Juanma Barranquero <address@hidden>
+
+ * tabify.el (untabify): Preserve the current column so that point
+ doesn't move (bug#6032).
+
2011-07-13 Lars Magne Ingebrigtsen <address@hidden>
* progmodes/cperl-mode.el (cperl-syntaxify-by-font-lock): Rewrite
=== modified file 'lisp/tabify.el'
--- a/lisp/tabify.el 2011-01-25 04:08:28 +0000
+++ b/lisp/tabify.el 2011-07-13 18:12:05 +0000
@@ -34,19 +34,21 @@
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r105173: Preserve point when doing untabify,
Lars Magne Ingebrigtsen <=