home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / mutt / contrib / smarttab.mut < prev    next >
Lisp/Scheme  |  1995-01-14  |  804b  |  32 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;; smart-tab : Use previous line as a tabbing templete if possible,  ;
  3. ;;             or act as a standrd tab if not.                       ;
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5. ;; Nadav Horesh Public Domain  2/93
  6.  
  7. (defun smart-tab {
  8.   (int prev-pos next-pos)
  9.  
  10.   (prev-pos (current-column)) 
  11.   (if (forward-line -1) {
  12.     (current-column prev-pos)
  13.     (if (looking-at '.+\<') {
  14.      (re-search-forward '.\<')
  15.      (next-pos (current-column))
  16.      (next-line)
  17.      (current-column prev-pos)
  18.      (to-col next-pos)
  19.      (current-column next-pos)
  20. ;     (msg next-pos)
  21.      (done)
  22.      }
  23.     )
  24.    }
  25.   )
  26.     ; else  
  27.      (next-line)
  28.      (current-column prev-pos)
  29.      (tab)
  30.      (msg "Hard TAB")
  31.   })
  32.