help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Displaying tabs


From: Deephanphongs, David
Subject: RE: Displaying tabs
Date: Tue, 9 Jan 2001 13:51:25 -0500

Whoops - I interpreted his request in exactly the wrong way.

Again, multiple ways to do it:
Easy way - put this is .emacs file:

(defun eight_spaces ()
        (interactive)
        (insert "        ")
)

(global-set-key '[tab] 'eight_spaces)

You may have to add
(local-set-key '[tab] 'eight_spaces)
to your c-mode-hook.

Note that this will insert eight spaces, not a TAB character..


The harder way is to make sure that all of the indentations
in c-mode use full tabs:


Make sure you are in c-mode (hit "Ctrl-H m" to view the current
mode info).
ESC x set-variable
c-basic-offset
8

(I think this defaults to 8, actually, so you may not have to do it.)

Then look at the help for c-offsets-alist:
Ctrl-h v c-offsets-alist

At the bottom of the help, there should be a list of all of the current
values:

((string . c-lineup-dont-change)
 (c . c-lineup-C-comments)
 (defun-open . 0)
 (defun-close . 0)
 (defun-block-intro . +)
 (class-open . 0)
 (class-close . 0)
 (inline-open . 0)
 (inline-close . 0)
.....

The first element is the name, the second is the offset.
For every entry that does not have either a "0" or a "+" as an offset,
put (c-set-offset 'name '+) or (c-set-offset 'name '0) - depending on
whether
you want it to tab or not - into your c-mode-hook.

(Mind you, I've seen Tim's latest response, and, frankly, I'm more confused
than ever, now - It does what you want, but it doesn't?  You may be better
off
with the easy option..)


Dave

> -----Original Message-----
> From: Moore, Mathew L [mailto:address@hidden
> Sent: Tuesday, January 09, 2001 12:03 PM
> To: Deephanphongs, David; 'address@hidden'
> Cc: 'Timothy M. Schaeffer'
> Subject: RE: Displaying tabs
> 
> 
> I think Tim is looking for a way to make TAB always display n-spaces.
> Doesn't tab-to-tab-stop simply go to the next tab stop?  Example:
> 
> abcd<TAB>
> 
> Tab goes to column 8 (the next tab-stop).
> 
> What would be nice is if <TAB> went to column 12 (tab-width 
> of 8 + the 4
> characters 'abcd').  Likewise, if you typed
> 
> abcdefg<TAB>
> 
> it would be nice if <TAB> moved to column 15, rather than the 
> column 8 it
> does with the tab-to-tab-stop.
> 
> Once upon a time, I looked for an easy solution to this, but 
> couldn't find
> anything.  Any help would be great!
> 
> --Matt
> 
> 
> -----Original Message-----
> From: Deephanphongs, David [mailto:address@hidden
> Sent: Tuesday, January 09, 2001 11:41 AM
> To: 'address@hidden'
> Cc: 'Timothy M. Schaeffer'
> Subject: RE: Displaying tabs
> 
> 
> Three ways:
> 
> 
> simplist way - turn off c-mode:
> ESC x text-mode
> 
> 
> Medium way - rebind [TAB]:
> ESC x global-set-key 
> TAB
> tab-to-tab-stop
> 
> 
> hard way - turn off c-mode's indentation - I have no idea how
> to do that completely..
> 
> I suspect that you'll have to do this every time you start emacs -
> possibly even for every c-file that you open.
> If you want to avoid that, you'll have to do more stuff:
> For solution 1, remove .c, .cc, .cpp, .h, from the auto-mode-alist
> variable.
> For solution 2, add 
> (local-set-key '[tab] 'tab-to-tab-stop)
> to your c-mode-hook..
> 
>  
> Dave
> 
> > -----Original Message-----
> > From: Timothy M. Schaeffer [mailto:address@hidden
> > Sent: Tuesday, January 09, 2001 10:00 AM
> > To: address@hidden
> > Subject: Displaying tabs
> > 
> <snip>
> 
> > Is there a way to have tabs always displayed as tab-width 
> > spaces? I want
> > tabs to be displayed  as indentation, always the same size, 
> > no matter where
> > on a line it starts.  Do I have to modify the sources to do this?
> > 
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]