At 998336235s since epoch (08/20/01 14:37:15 -0400 UTC), Andrew Dixon wrote:
> Hi All,
> Does anyone know how to set xemacs to use 4 spaces when you hit the tab
> key?  I've tried adding:
> 
> ;;Use spaces instead of tabs
> (setq-default indent-tabs-mode nil)
> ;;set the width to 4
> (setq-default tab-width 4)

Looks close to what I have... you can try this and see if it works any
beter.

;;;;;;;

;; Tab code thanks to JWZ: http://www.jwz.org/doc/tabs-vs-spaces.html
; Auto expand tabs to spaces, at modulo 4
(setq tab-width 4)
(setq indent-tabs-mode nil) 

; On file write, expand all tabs to spaces
(defun text-mode-untabify ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "[ \t]+$" nil t)
      (delete-region (match-beginning 0) (match-end 0)))
    (goto-char (point-min))
    (if (search-forward "\t" nil t)
        (untabify (1- (point)) (point-max))))
  nil)

(add-hook 'java-mode-hook 
          '(lambda ()
             (make-local-variable 'write-contents-hooks)
             (add-hook 'write-contents-hooks 'text-mode-untabify)))

;;;;;;;

Jason


--
Jason Healy    |     [EMAIL PROTECTED]
LogN Systems   |   http://www.logn.net/

Reply via email to