all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oodini <svdbg@free.fr>
Subject: Re: C formatting
Date: Sat, 28 Dec 2002 13:52:53 +0100	[thread overview]
Message-ID: <3E0D9EA5.8000306@free.fr> (raw)
In-Reply-To: 844r8y2yjv.fsf@lucy.cs.uni-dortmund.de

Kai Großjohann a écrit:


> I suggest to try C-c C-o on the first line that has wrong indentation
> and to follow the prompts.  Then hit TAB to reindent the line.  When
> you like the indentation, you can use C-x ESC ESC and then M-p/M-n to
> retrieve the right c-set-offset statement.  That's what you can put
> in the hook, below:

I started from what an user answer here gave me:

(add-hook 'c-mode-hook
	(function (lambda ()
		(c-set-style "bsd")
		(setq c-basic-offset 4)
	))
)

and then what what you said:
     C-x C-o
I get the the statement
     Syntactic symabol to change: substatement
I hit Enter...
     substatement offset (default +):
I put 0, and then I get the *wanted behaviour*.
     C-x ESC ESC
     redo (c-set-offset (quote substatement) 0 nil)

So I modify my .emacs:

(add-hook 'c-mode-hook
	(function (lambda ()
		(c-set-style "bsd")
		(setq c-basic-offset 4)
		(c-set-offset 0)
	))
)

But then I obtain a different behaviour.
Typically, after an "if", when I go on a new line to do my opening 
brace, and hit Tab, the offset is 12 characters (8 char tab, and four 
characters).

> You didn't say which version of Emacs you are using.  I'm assuming
> Emacs 21.  Probably the above works for Emacs 20, too.

21.2.1

-- 
  .      .
  .  .:::.          ###           \|/        `  ___  '
    :(o o):  .     (o o)         (o o)      -  (O o)  -
ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-

  reply	other threads:[~2002-12-28 12:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-28  0:17 C formatting Oodini
2002-12-28  0:39 ` Bijan Soleymani
2002-12-28 11:47   ` Oodini
2002-12-28 11:50     ` Oodini
2002-12-28 12:32       ` Jesper Harder
2002-12-28 13:05     ` Kai Großjohann
2002-12-28 13:13       ` Oodini
2002-12-28  1:11 ` chris.danx
2002-12-28 12:31   ` Oodini
2002-12-28 12:57     ` chris.danx
2002-12-28 13:03       ` Oodini
2002-12-28 13:03     ` Kai Großjohann
2002-12-28 11:05 ` Kai Großjohann
2002-12-28 12:52   ` Oodini [this message]
2002-12-28 13:50     ` Kai Großjohann
2002-12-28 13:53     ` Kai Großjohann

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=3E0D9EA5.8000306@free.fr \
    --to=svdbg@free.fr \
    /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.