home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / mutt / misc / tabs.mut < prev   
Text File  |  1995-01-14  |  486b  |  30 lines

  1. ;; [un]expand tabs
  2. ;; C Durland 10/93 Public Domain
  3.  
  4. (defun
  5.   tabs-to-spaces { (convert-um 8 "^I+") }
  6.   spaces-to-tabs { (convert-um 0 "[ ^I][ ^I]+") }
  7.   convert-um (int tab-size)(string um) HIDDEN
  8.   {
  9.     (int n)
  10.  
  11.     (n (tab-stops))
  12.     (tab-stops tab-size)
  13.  
  14.     (save-point
  15.       {{
  16.     (int col)
  17.  
  18.     (beginning-of-buffer)
  19.     (while (re-search-forward (arg 0))
  20.       {
  21.         (col (current-column))
  22.         (delete-previous-whitespace)
  23.         (to-col col)
  24.       })
  25.       }} um)
  26.  
  27.     (tab-stops n)
  28.   }
  29. )
  30.