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

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

Re: C formatting


From: Jesper Harder
Subject: Re: C formatting
Date: Sat, 28 Dec 2002 13:32:55 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Oodini <svdbg@free.fr> writes:

> Oodini a écrit:
>
>> I have already read the doc
>> (http://www.sunsite.ualberta.ca/Documentation/Gnu/emacs-18.59/html_node/emacs_150.html),
>> before to post and it didn't help me a lot.  It seems I don't
>> understand it as I should.
>
> Well, it is an old doc. I have found this link with Google, but is
> about release 18.59 (seen in the URL) .... And I am using 21.2.1

Yes, it is obsolete for Emacs 21.  Use the documentation that comes
with Emacs instead -- do

     `C-h i m cc mode'

in Emacs to display the current documentation.  If you're not familiar
with the Emacs documentation system you might want to take the Info
tutorial first:

     `C-h i h'
>From help-gnu-emacs-bounces@gnu.org  Sat Dec 28 07:55:09 2002
Path: 
shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!wanadoo.fr!proxad.net!feeder2-1.proxad.net!news3-2.free.fr!not-for-mail
Message-ID: <3E0D9EA5.8000306@free.fr>
Date: Sat, 28 Dec 2002 13:52:53 +0100
From: Oodini <svdbg@free.fr>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR;
        rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: fr-fr, fr
MIME-Version: 1.0
Newsgroups: gnu.emacs.help
References: <3E0CED7C.7020002@free.fr>
        <844r8y2yjv.fsf@lucy.cs.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 54
Organization: Guest of ProXad - France
NNTP-Posting-Date: 28 Dec 2002 13:52:04 MET
NNTP-Posting-Host: 212.11.42.3
X-Trace: 1041079924 news3-2.free.fr 22318 212.11.42.3:3145
X-Complaints-To: abuse@proxad.net
Xref: shelby.stanford.edu gnu.emacs.help:108539
To: help-gnu-emacs@gnu.org
Subject: Re: C formatting
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
List-Archive: <http://mail.gnu.org/pipermail/help-gnu-emacs>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/help-gnu-emacs>,
        <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
X-List-Received-Date: Sat, 28 Dec 2002 12:55:09 -0000

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 via email to

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