[comp.emacs] Making TAB = 4 no matter what

baileyc@tramp.Colorado.EDU (BAILEY CHRISTOPHER R) (11/12/90)

I want to make a tab in emacs go 4 spaces every time I press tab.  I am
mostly using C-mode, and I have c-indent-level set to 4, and 
c-tab-always-indent set to nil so I can tab in the middle of a line.  
However, the tabs in the middle of a line go 8 spaces, and I want them
to go only 4 spaces.  Also, if I do something like:
#ifndef lint
	static char *RCSid=...
#endif
The static char line will only be indented 2 instead of 4.  I know there must
be one of those strange c-mode varaibles dealing with this type of stuff, but
I don't know what it is, or if there isn't how do I change this?  it's not
a big deal for preprocessor stuff, but I'd still like to change it.  In 
other words, I want tab to go 4 spaces in every mode, and every conditions
within emacs.  How do I do this?



Chris Bailey :: baileyc@tramp.Colorado.EDU
One Agro Mountain Biker - Dialed in for ultra gonzo badness!
"No his mind is not for rent, to any god or government" - RUSH
Member of Team Buck Naked of Buckingham Palace

mdb@ESD.3Com.COM (Mark D. Baushke) (11/14/90)

If you want tab stops to always be a multiple of 4, the variable
tab-stop-list should be modified to something like:

(setq tab-stop-list
  '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92
    96 100 104 108 112 116 120))

There is also a small glitch in c-mode.el which inserts a literal tab
instead of going to the next tab stop. Here is a fix for that:

*** lisp/c-mode.el~	Fri May 27 18:28:12 1988
--- lisp/c-mode.el	Tue Nov 13 09:51:29 1990
***************
*** 287,293 ****
  	     (save-excursion
  	       (skip-chars-backward " \t")
  	       (not (bolp))))
! 	(insert-tab)
        (c-indent-line))))
  
  (defun c-indent-line ()
--- 287,295 ----
  	     (save-excursion
  	       (skip-chars-backward " \t")
  	       (not (bolp))))
! ;;	(insert-tab)
! ;; modified by mdb: tab to tab stop seems more friendly, no?
! 	(tab-to-tab-stop)
        (c-indent-line))))
  
  (defun c-indent-line ()

It would be nice if 18.56 would include the above patch.

Of course, you would not need to modify c-mode if you arrange to set
indent-tabs-mode to nil for every c-mode buffer you visit. This
variable controls the insertion of the tab character into a buffer.

Enjoy!
-- 
Mark D. Baushke
mdb@ESD.3Com.COM