Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to set emacs to use tabs for indentation only?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Xah Lee  
View profile  
 More options Feb 27 2012, 12:35 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Xah Lee <xah...@gmail.com>
Date: Sun, 26 Feb 2012 21:35:10 -0800 (PST)
Local: Mon, Feb 27 2012 12:35 am
Subject: how to set emacs to use tabs for indentation only?
does anyone know how to setup emacs so that the tab key do indentation
as usual but never insert any space?

recently i discovered Microsoft Visual Studio takes that approach.
Also, Google Go language has a mechanical means to force all
indentation to be tabs.

 Xah


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hjuvi  
View profile  
 More options Feb 27 2012, 5:21 am
Newsgroups: gnu.emacs.help, comp.emacs
From: hjuvi <hjuvi-goo...@yahoo.fr>
Date: Mon, 27 Feb 2012 02:21:48 -0800 (PST)
Local: Mon, Feb 27 2012 5:21 am
Subject: Re: how to set emacs to use tabs for indentation only?
Add this line in your ~/.emacs:
(setq-default indent-tabs-mode t)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Xah Lee  
View profile  
 More options Feb 28 2012, 3:28 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Xah Lee <xah...@gmail.com>
Date: Tue, 28 Feb 2012 00:28:27 -0800 (PST)
Local: Tues, Feb 28 2012 3:28 am
Subject: Re: how to set emacs to use tabs for indentation only?
On Feb 27, 2:21 am, hjuvi <hjuvi-goo...@yahoo.fr> wrote:

> Add this line in your ~/.emacs:
> (setq-default indent-tabs-mode t)

that gives you mixed tabs and spaces.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jpkotta  
View profile  
 More options Feb 28 2012, 4:26 am
Newsgroups: comp.emacs
From: jpkotta <jpko...@gmail.com>
Date: Tue, 28 Feb 2012 01:26:25 -0800 (PST)
Local: Tues, Feb 28 2012 4:26 am
Subject: Re: how to set emacs to use tabs for indentation only?

On Tuesday, February 28, 2012 2:28:27 AM UTC-6, Xah Lee wrote:
> On Feb 27, 2:21 am, hjuvi <hjuvi-goo...@yahoo.fr> wrote:
> > Add this line in your ~/.emacs:
> > (setq-default indent-tabs-mode t)

> that gives you mixed tabs and spaces.

I use http://www.emacswiki.org/emacs/SmartTabs.  It may insert spaces, but never to indent code, only to align continued lines.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Rumney  
View profile  
 More options Feb 28 2012, 9:39 am
Newsgroups: comp.emacs
From: Jason Rumney <jasonrum...@gmail.com>
Date: Tue, 28 Feb 2012 06:39:56 -0800 (PST)
Local: Tues, Feb 28 2012 9:39 am
Subject: Re: how to set emacs to use tabs for indentation only?

On Tuesday, 28 February 2012 16:28:27 UTC+8, Xah Lee  wrote:
> On Feb 27, 2:21 am, hjuvi <hjuvi-goo...@yahoo.fr> wrote:
> > Add this line in your ~/.emacs:
> > (setq-default indent-tabs-mode t)

> that gives you mixed tabs and spaces.

You may need to set tab-width to the basic indentation step that you require. Default is 8.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Xah Lee  
View profile  
 More options Feb 28 2012, 9:21 pm
Newsgroups: gnu.emacs.help, comp.emacs
From: Xah Lee <xah...@gmail.com>
Date: Tue, 28 Feb 2012 18:21:51 -0800 (PST)
Local: Tues, Feb 28 2012 9:21 pm
Subject: Re: how to set emacs to use tabs for indentation only?
On Feb 26, 9:35 pm, Xah Lee <xah...@gmail.com> wrote:

> does anyone know how to setup emacs so that the tab key do indentation
> as usual but never insert any space?

> recently i discovered Microsoft Visual Studio takes that approach.
> Also, Google Go language has a mechanical means to force all
> indentation to be tabs.

On Feb 28, 11:09 am, stan <smo...@exis.net> wrote:

> Do you want all spaces or are you suggesting some hidden code that
> knows how to indent?

i want all tabs for indentation. No space at all.

 Xah


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Mackenzie  
View profile  
 More options Feb 29 2012, 4:00 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Alan Mackenzie <a...@muc.de>
Date: Wed, 29 Feb 2012 09:00:03 +0000 (UTC)
Local: Wed, Feb 29 2012 4:00 am
Subject: Re: how to set emacs to use tabs for indentation only?
Hello, Xah.

In gnu.emacs.help Xah Lee <xah...@gmail.com> wrote:

> does anyone know how to setup emacs so that the tab key do indentation
> as usual but never insert any space?

In elisp, no chance, unless you set tab-width to 1.  ;-)

In C-like languages, set tab-width and c-basic-offset to be the same, and
set entries in c-offsets-alist to indent only in multiples of
c-basic-offset.

In other language modes it is surely possible and easy.

> recently i discovered Microsoft Visual Studio takes that approach.
> Also, Google Go language has a mechanical means to force all
> indentation to be tabs.
> Xah

--
Alan Mackenzie (Nuremberg, Germany).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Xah Lee  
View profile  
 More options Feb 29 2012, 4:20 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Xah Lee <xah...@gmail.com>
Date: Wed, 29 Feb 2012 01:20:32 -0800 (PST)
Local: Wed, Feb 29 2012 4:20 am
Subject: Re: how to set emacs to use tabs for indentation only?
hi Alan!

thanks coming to the rescue. Of all the people, am thinking you are
the top expert i know of on this.

Xah Lee wrote:

«does anyone know how to setup emacs so that the tab key do
indentation as usual but never insert any space?»

Alan Mackenzie wrote:

« In elisp, no chance, unless you set tab-width to 1.  ;-)»

aww. Sad.

Alan wrote:

«In C-like languages, set tab-width and c-basic-offset to be the same,
and set entries in c-offsets-alist to indent only in multiples of c-
basic-offset.»

Cool. I'll try to see if i can get that to work in perl and python
mode. Not a need, but been wanting to experiment on this for long.

really wanted for elisp mode but too bad.

Btw, is there one place that document/tutorial in detail perhaps with
clarity on all the indentation related settings for c-mode? e.g. if i
want X style, do this and that, if i want Y style, do that and this.

 Xah


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Monnier  
View profile  
 More options Feb 29 2012, 9:50 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Stefan Monnier <monn...@iro.umontreal.ca>
Date: Wed, 29 Feb 2012 09:50:48 -0500
Local: Wed, Feb 29 2012 9:50 am
Subject: Re: how to set emacs to use tabs for indentation only?

>> does anyone know how to setup emacs so that the tab key do indentation
>> as usual but never insert any space?
> In elisp, no chance, unless you set tab-width to 1.  ;-)

Actually, you might be able to get some major gross hack working in 99%
of the programming language modes by advising indent-to along the lines
of:

(defadvice indent-to (after sm-only-use-tabs activate)
  (when (eq ?\s (char-before))
    (delete-char (- (skip-chars-backward " ")))
    (insert "\t")))

Of course, one major hurdle will be to make this advice actually active,
because indent-to has its own byte-code (yup, as if this was
a performance-sensitive operation), so all uses of indent-to from .elc
files will happily ignore the advice.

        Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
stan  
View profile  
 More options Feb 29 2012, 3:35 pm
Newsgroups: comp.emacs
From: stan <smo...@exis.net>
Date: Wed, 29 Feb 2012 15:35:05 -0500
Local: Wed, Feb 29 2012 3:35 pm
Subject: Re: how to set emacs to use tabs for indentation only?

Xah Lee wrote:
> «does anyone know how to setup emacs so that the tab key do
> indentation as usual but never insert any space?»

> Alan Mackenzie wrote:
> « In elisp, no chance, unless you set tab-width to 1.  ;-)»

> aww. Sad.

Are you actually concerned with how emacs does indent or the final
stored results? What I mean is would an external filter work? You're
only concerned about the leading tabs (indentation) and not all tabs
anywhere in a line right?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Mackenzie  
View profile  
 More options Mar 3 2012, 5:04 am
Newsgroups: gnu.emacs.help, comp.emacs
From: Alan Mackenzie <a...@muc.de>
Date: Sat, 3 Mar 2012 10:04:37 +0000 (UTC)
Local: Sat, Mar 3 2012 5:04 am
Subject: Re: how to set emacs to use tabs for indentation only?
In comp.emacs Xah Lee <xah...@gmail.com> wrote:

> hi Alan!
> thanks coming to the rescue. Of all the people, am thinking you are
> the top expert i know of on this.

Hey, thanks!

It's all in the CC Mode manual.  ;-)  In the chapter "Customizing
Indentation".

> Xah

--
Alan Mackenzie (Nuremberg, Germany).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lowell Gilbert  
View profile  
 More options Mar 3 2012, 6:31 pm
Newsgroups: gnu.emacs.help, comp.emacs
From: Lowell Gilbert <lguse...@be-well.ilk.org>
Date: Sat, 03 Mar 2012 18:31:39 -0500
Local: Sat, Mar 3 2012 6:31 pm
Subject: Re: how to set emacs to use tabs for indentation only?

Xah Lee <xah...@gmail.com> writes:
> Xah Lee wrote:
> «does anyone know how to setup emacs so that the tab key do
> indentation as usual but never insert any space?»

> Alan Mackenzie wrote:
> « In elisp, no chance, unless you set tab-width to 1.  ;-)»

> aww. Sad.

Not really; it's not *impossible*, but it requires agreeing on the
display width of a tab. In my experience, that's a major task even in
all-vi shops. It's a little harder in emacs because so many emacs
programmers have swung away from even trying to agree on tab widths;
but it's a political battle more than a technical one, and I'd rather
not waste my time on political battles in how to save source code.

> Alan wrote:
> «In C-like languages, set tab-width and c-basic-offset to be the same,
> and set entries in c-offsets-alist to indent only in multiples of c-
> basic-offset.»

> Cool. I'll try to see if i can get that to work in perl and python
> mode. Not a need, but been wanting to experiment on this for long.

> really wanted for elisp mode but too bad.

Well, that depends on what you want the indentation to actually
look like. My own indentation for elisp is (admittedly) a little
idiosyncratic, but even I can't imagine finding elisp readable
with indentations that were limited to multiples of something
larger than 1.  I'd probably need to see a specific example to
understand the underlying principles.

> Btw, is there one place that document/tutorial in detail perhaps with
> clarity on all the indentation related settings for c-mode? e.g. if i
> want X style, do this and that, if i want Y style, do that and this.

Don't use styles for C-related modes. They are useful for imitating
someone else's style, not for creating your own.  Once you have
indentation doing what you want, you can define a *new* style with the
settings you want.

--
Lowell Gilbert, embedded/networking software engineer
         http://be-well.ilk.org/~lowell/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »