all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nerius Landys <nlandys@gmail.com>
To: Steve Revilak <steve@srevilak.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [emacs] tabs, spaces, and indentation
Date: Mon, 11 Oct 2010 13:19:40 -0700	[thread overview]
Message-ID: <AANLkTi=eM1wriOi=bsRpMEh5WfCyyL3mVGKn_oCDu2oa@mail.gmail.com> (raw)
In-Reply-To: <20101009020801.GD4996@srevilak.net>

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

> CC-mode gives you a lot of options for controlling indentation.
>
>  M-x Info-goto-node RET (ccmode)Commands RET
>
> The subsections "Indentation commands", "Minor Modes" and "Electric
> keys" will probably be the most relevant for what you're trying to
> accomplish.
>
> For (1) something like
>
>  (setq c-basic-offset 8
>       indent-tabs-mode t
>       c-insert-tab-function 'tab-to-tab-stop)
>
>  (setq c-syntactic-indentation nil) ; maybe, or maybe not this one
>
> should be close to the behavior you're looking for.
>
> For (2), try
>
>  (c-toggle-electric-state -1)
>
>
>
Thanks a lot for this information.  I have taken your tips and done
additional online research.  I came up with the following .emacs file for
this project that has absolutely horrid indentation and use of tabs:

  (defun my-c-mode-common-hook ()
    (c-toggle-electric-state -1)
    (define-key c-mode-base-map (kbd "TAB") 'self-insert-command))
  (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


It almost behaves how I want now.  I hit Tab, it creates a tab.  It does not
start indenting stuff when I type a special character such as a paren or a
semicolon.  However, there is still one thing needed to make it behave just
like Notepad.  Let's say my cursor is positioned immediately following a tab
character.  When I hit Backspace (I believe that causes a function
"backward-delete-char" to be called), it converts that tab character into a
bunch of spaces, then deletes the last space.  I would really like Backspace
to just delete the tab character.  Is there any way to do this?  I suppose
I'd have to rebind Backspace to a function other than backward-delete-char,
but I'm not sure which function.

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

  reply	other threads:[~2010-10-11 20:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=eM1wriOi=bsRpMEh5WfCyyL3mVGKn_oCDu2oa@mail.gmail.com' \
    --to=nlandys@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=steve@srevilak.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.