From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael.cadilhac@lrde.org (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: [Proposal] M-x tabify to indent only when needed. Date: Mon, 24 Jul 2006 19:30:31 +0200 Organization: Epita/LRDE Message-ID: <8764hm7vwo.fsf@lrde.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1644224493==" X-Trace: sea.gmane.org 1153762294 5490 80.91.229.2 (24 Jul 2006 17:31:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Jul 2006 17:31:34 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 24 19:31:29 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G54Gf-0003uY-0W for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 19:30:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G54Ge-0000fo-E0 for ged-emacs-devel@m.gmane.org; Mon, 24 Jul 2006 13:30:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G54GR-0000fh-Jh for emacs-devel@gnu.org; Mon, 24 Jul 2006 13:30:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G54GJ-0000dH-L5 for emacs-devel@gnu.org; Mon, 24 Jul 2006 13:30:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G54GJ-0000dD-EG for emacs-devel@gnu.org; Mon, 24 Jul 2006 13:30:35 -0400 Original-Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1G54HR-0001OS-GE for emacs-devel@gnu.org; Mon, 24 Jul 2006 13:31:45 -0400 Original-Received: from mahaena.lrde.epita.fr ([192.168.101.66] helo=mahaena.lrde) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1G54GD-0003NC-6P for emacs-devel@gnu.org; Mon, 24 Jul 2006 19:30:29 +0200 Original-To: emacs-devel@gnu.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEU/JREXDATg1LV8UCao i1fQpmoP3Nd6AAACa0lEQVQ4jWWUQW7jMAxFqZEPICJzAjXeM6W8dyNqX9ji/a8yn04xnWIEJLD9 LJH85DcJFyJV3erqPty8ExHfBikXSdn0WVezC0hOAQiA2nCsAHOqEnPe4k+puU8zw/t+xquqjRKA 4lHsmQBT8C5pDtBwfwH8VdcHI5+FHtjRxrQRwZsf3hNjZRKAPEzHEdH9mFNSYb5dQK3r8KM6ftNy KikAirDZFWdVkDqbxjGFbAcwbQCxxc8mPRHUGOcCIMgMACV23RfJTch3gC6ofT3qCdG0NyUUPfYF yQrKCIAnuYsgX2qPzW2i9sNrfSOSPPZQiygtCNlCjlpXJV38lIKshF/AZzsAMoArdCKNHfXukPuJ ImbLh+9J2gXwap0QpZ7NjZ7ekdkFcDiqPiLGcHmuvaG/AHgy62s52Lae1ABoA7D6d2kDoAvgbnyD ZutEd6lTHOXfYPHVJDH1K8a1+oyrjoZpAGn1x5pfwPr2E9yjxSpk50/gEyKgD/+BD/KzN3tQ13b8 Cx5loF0AgnZf5IUny9hRHQOYBllHDM+6s3oviZBu77mFjDm621Np3hkjR90wE1BkTYvhdDgDgCmR xWChFfcYAOqMm5NZkVWMur8AL5+oeMQOob2FmY76FiM+PrDDZypwGdqokSlAaQOmGH6mW8KpsOwl 0YOLedjSITr6scNRF8D4PesH33QmLrx8AzjpV/3kkg025w2gfAFYKCLluJAc4Ap+h18oo4S8wzaY klDsBUTiY8EZFkg5Iass75FubC9wd8qa0u9+gRxAsAKEaRAo6iB+vwCMGmdBjvgidQGA1ntMX4CS ZYGV/wADyL80LIX/UAAAAABJRU5ErkJggg== User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:57553 Archived-At: --===============1644224493== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable 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 =AB tabs then spaces less than a tab. =BB. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: inline; filename=tabify.patch Content-Transfer-Encoding: quoted-printable Index: lisp/tabify.el =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =2D-- lisp/tabify.el 24 Jul 2006 17:21:48 -0000 *************** *** 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)))))) =20=20 (provide 'tabify) =20=20 =2D-- 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 ! (goto-char (match-beginning 0)) ! (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))))))) =20=20 (provide 'tabify) =20=20 Index: lisp/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =2D-- lisp/ChangeLog 24 Jul 2006 17:21:50 -0000 *************** *** 1,0 **** =2D-- 1,4 ---- + 2006-07-24 Micha=EBl Cadilhac +=20 + * tabify.el (tabify): Check if not already tabified before indenting. +=20 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable TIA! =2D-=20 | Micha=EBl `Micha' Cadilhac | Le copillage-collage = | | Epita/LRDE Promo 2007 | tue le programmeur. = | | http://www.lrde.org/~cadilh_m | -- Dictons LRDE = | `-- - JID: micha@amessage.be --' - -= -' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFExQO3ZYNf4qobZ7kRAoUMAJsESCRpsLFXu/ys3eSPORTozobpGQCdHdcq UjoTK3xBLc9AWBY+Ryx19m0= =/0Ha -----END PGP SIGNATURE----- --==-=-=-- --===============1644224493== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1644224493==--