From: Rich Johns <[EMAIL PROTECTED]>

   Thanks Steve. I've tried to use this on files that were originally
   written with the tab==spaces approach, but it doesn't seem to
   convert all the spaces to tabs.

No.  The code I sent converts all tabs to spaces immediate before the
buffer is written to disk.  If you wanted the reverse, to have spaces
maximally replaced by tabs, then you could do this by having it call
uabify instead of tabify.

   I can understand why, becuase
   there would be places where you really wanted spaces. I guess
   what I would want is just the indention spaces changed. Not sure
   if that is possible.
   
   The other thing that plagues me is not being able to hit tab
   2 times to get an indention of 8. For example, some people
   on my team like 8 space indent, so when I go into their code
   and try to honor their indention scheme, I have to use 1 tab and
   4 spaces.
   
   void foo() {
           int i = 0; // this is where the original author goes with tabs.
       int x = 1;  // this is where I can go with a tab
   }
   
   Is this due to the syntax intelligent indention via cc-mode? Actually
   I'm using jde mode which I believe totally relies on cc-mode.

The code I sent has nothing whatever with the action of indenting.  It
only cleans up the irregular effects of editing, again, right before
writing out the buffer.
   
   I really prefer spaces because I think it is ultimately the answer to
   indention harmony within a development group. But, the rule in this
   group is tabs. I'll get used to ....
   
   thanks
   
   Steve Haflich wrote:
   
   > The key is M-x untabify.  You can invoke this automatically with
   > something like te following untested form in your ~/.emacs
   >
   > (add-hook java-mode
   >           (function (lambda ()
   >                       (add-hook 'local-write-file-hooks
   >                                 (function (lambda ()
   >                                   (save-excursion
   >                                     (widen)
   >                                     (untabify (point-min) (point-max)))))))))
   >
   > This is a good way to install other mode-specific source normalization
   > hooks.  For instance, I always delete trailing whitespace in my source
   > buffers.  This greatly reduces the noise merge diff output during
   > cooperative development.
   >
   > Remember, this will munge your code in ways you dno't expect if you
   > have literal tab chars inside literal strings.

Reply via email to