[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Proposal] M-x tabify to indent only when needed.
From: |
Michaël Cadilhac |
Subject: |
Re: [Proposal] M-x tabify to indent only when needed. |
Date: |
Mon, 24 Jul 2006 22:40:15 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
address@hidden (Michaël Cadilhac) writes:
> M-x tabify has an unexpected behavior with files that are already
> tabified: once it is called, the file is set to be modified. In fact,
> the regions of spaces are removed and then re-added.
>
> Can the following patch be applied to change this behavior?
>
> It checks that the region we are going to delete is not already of the
> form « tabs then spaces less than a tab. ».
... Sorry for the noise, the previous patch was no good. Please
consider the following one.
*** lisp/tabify.el.~1.19.~ 2006-02-06 15:33:35.000000000 +0100
--- lisp/tabify.el 2006-07-24 22:33:57.000000000 +0200
***************
*** 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)
--- 75,90 ----
(while (re-search-forward tabify-regexp nil t)
(let ((column (current-column))
(indent-tabs-mode t))
! ;; Whether already tabified.
! (unless (save-match-data
! (save-excursion
! (skip-chars-backward " ")
! (string-match
! (format "^\t* \\{0,%d\\}$"
! (- tab-width (1+ (mod (current-column)
tab-width))))
! (match-string 0))))
! (delete-region (match-beginning 0) (point))
! (indent-to column)))))))
(provide 'tabify)
*** lisp/ChangeLog.~1.9820.~ 2006-07-17 13:27:46.000000000 +0200
--- lisp/ChangeLog 2006-07-24 19:20:58.000000000 +0200
***************
*** 1,0 ****
--- 1,4 ----
+ 2006-07-24 Michaël Cadilhac <address@hidden>
+
+ * tabify.el (tabify): Check if not already tabified before indenting.
+
TIA!
--
| Michaël `Micha' Cadilhac | Pour les 35-40 ans, l'humour |
| Epita/LRDE Promo 2007 | c'est une plus-value. |
| http://www.lrde.org/~cadilh_m | -- Guillaume L. |
`-- - JID: address@hidden --' - --'
pgptRkjrOZZGI.pgp
Description: PGP signature
- [Proposal] M-x tabify to indent only when needed., Michaël Cadilhac, 2006/07/24
- Re: [Proposal] M-x tabify to indent only when needed.,
Michaël Cadilhac <=
- Re: [Proposal] M-x tabify to indent only when needed., Stefan Monnier, 2006/07/24
- Re: [Proposal] M-x tabify to indent only when needed., Richard Stallman, 2006/07/24
- Re: [Proposal] M-x tabify to indent only when needed., Stefan Monnier, 2006/07/25
- Re: [Proposal] M-x tabify to indent only when needed., Michaël Cadilhac, 2006/07/25
- Re: [Proposal] M-x tabify to indent only when needed., Stefan Monnier, 2006/07/25
- Re: [Proposal] M-x tabify to indent only when needed., Michaël Cadilhac, 2006/07/25
- Re: [Proposal] M-x tabify to indent only when needed., Stefan Monnier, 2006/07/25
- Re: [Proposal] M-x tabify to indent only when needed., Michaël Cadilhac, 2006/07/25
Re: [Proposal] M-x tabify to indent only when needed., Richard Stallman, 2006/07/24