unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [emacs] tabs, spaces, and indentation
@ 2010-10-06 20:06 Nerius Landys
  2010-10-07  4:22 ` PJ Weisberg
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Nerius Landys @ 2010-10-06 20:06 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]

Hi.  I use emacs all the time for programming and shell scripting.  Now I'm
dabbling in an open source project that is written in C, and the entire code
base uses tabs extensively (instead of spaces for indentation).  I very much
prefer to use spaces for indentation; however I must use tabs for this
project in order to make the code consistent.  I am looking for some quick
command or something that will place my emacs into a special mode that is
suitable for working with tabbed C code.  Then of course I'd like a command
that puts me back into the regular settings that I have and am used to.  (In
other words, a toggle on and off.)

Here are some details.

I am running FreeBSD 8.0 and I have emacs installed with no X11, from the
port editors/emacs-nox11.  The version of emacs is 23.2_4,2.  I have no
additional bells and whistles installed for emacs other than what comes with
this FreeBSD port and my .emacs config, which is more or less like so:

(setq transient-mark-mode t)
(setq make-backup-files nil)
;(setq-default indent-tabs-mode nil) [ commented out ]
(setq-default c-basic-offset 2)

I tried searching on Google for commands that may help me, but most of what
I found explained how to enable the kind of behavior that I'm NOT looking
(I'm going in the opposite direction unfortunately).

The current default behavior that I am experiencing is as follows:

1. When I hit the Tab key, it indents the current line at the correct
indentation level.  Existing Tabs are preserved but spaces might be added.
2. When I complete some syntax on a line, such as adding a semicolon or
closing a paren, it indents the line for me automatically.

The behavior for this particular mode of operation that would be nice is as
follows:

1. Hitting the Tab key places a literal Tab character in my file.  That is
all.
2. I notice that sometimes when I complete a like (e.g. adding a semicolon
or adding a paren) it auto-indents for me.  I want to turn this off
completely.

Is it possible to toggle the mode consisting of #1 and #2 on and off?
Please help, and thank you very much!

[-- Attachment #2: Type: text/html, Size: 2190 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <mailman.5.1286400966.24129.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2010-10-12  1:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 20:06 [emacs] tabs, spaces, and indentation Nerius Landys
2010-10-07  4:22 ` PJ Weisberg
2010-10-08 21:44   ` PJ Weisberg
2010-10-08 22:12     ` Nerius Landys
2010-10-07  6:26 ` Jonathan Groll
     [not found] ` <mailman.5.1286432793.11901.help-gnu-emacs@gnu.org>
2010-10-07  9:30   ` Stefan Monnier
2010-10-09  2:08 ` Steve Revilak
2010-10-11 20:19   ` Nerius Landys
2010-10-11 21:43     ` PJ Weisberg
2010-10-11 22:14       ` Nerius Landys
2010-10-12  1:42     ` Steve Revilak
     [not found]   ` <mailman.3.1286828409.23066.help-gnu-emacs@gnu.org>
2010-10-11 21:58     ` Pascal J. Bourguignon
     [not found] <mailman.5.1286400966.24129.help-gnu-emacs@gnu.org>
2010-10-06 22:05 ` despen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).