emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 25 Jul 2006 17:28:42 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>>> +          (if (= (/ end-col tab-width) (/ beg-col tab-width))
>>>> +              ;; The spacing does not straddle a TAB boundary, so we won't
>>>> +              ;; be able to use a TAB here anyway: there's nothing to do.
>>>> +              nil
>>> 
>>>> This detects a case where no tabs can be used.
>>>> It doesn't detect the case where tabs already ARE used.
>>> 
>>> Those cases aren't matched by the regexp.
>>> 
>>>> -(defvar tabify-regexp "[ \t][ \t]+"
>>>> +(defvar tabify-regexp " [ \t]+"
>>> 
>>>> Is that change supposed to exclude those other cases?
>>> 
>>> Exactly.
>>> 
>>> Stefan
>
>> IIUC,  your  patch does  work  and is  very  much  clearer than  mine.
>> However, it suffers from the same precondition on tabify-regexp, which
>> should be described in its docstring.
>
> Another regexp will also work, except that it may result in "spurious"
> buffer modifications.  But people have lived with such spurious buffer
> modifications until now, so it's not a big deal, is it?

Well... Why not tell the user how to get good results?

Whatever, the docstring should be modified to tell that
\"^\\\\( \\t*\\\\)+\" must be used for « tabifying only initial
whitespace » (IINM).

-- 
 |      Michaël `Micha' Cadilhac   |  Would someone please DTRT with this,  |
 |         Epita/LRDE Promo 2007   |        then ACK?                       |
 | http://www.lrde.org/~cadilh_m   |          -- Richard Stallman           |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpbjgscoLjX2.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]