* how to set c-set-style at startup?
@ 2011-07-18 22:58 Jai Dayal
2011-07-18 23:17 ` Deniz Dogan
2011-07-19 5:03 ` Peter Münster
0 siblings, 2 replies; 7+ messages in thread
From: Jai Dayal @ 2011-07-18 22:58 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
Hi,
It seems right now, I have to do c-set-style for each file/buffer I open.
Is there a way I can set this in my .emacs file so that all files will have
the same c style indentation?
Thanks,
Jai
[-- Attachment #2: Type: text/html, Size: 217 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-18 22:58 how to set c-set-style at startup? Jai Dayal
@ 2011-07-18 23:17 ` Deniz Dogan
2011-07-19 5:03 ` Peter Münster
1 sibling, 0 replies; 7+ messages in thread
From: Deniz Dogan @ 2011-07-18 23:17 UTC (permalink / raw)
To: help-gnu-emacs
On 2011-07-19 00:58, Jai Dayal wrote:
> Hi,
> It seems right now, I have to do c-set-style for each file/buffer I
> open. Is there a way I can set this in my .emacs file so that all files
> will have the same c style indentation?
>
> Thanks,
> Jai
I think you may want to try:
M-x customize-group RET c RET
I think "C Default Style" is what you're looking for, but I don't know
C, so I can't be sure.
Hope that helps,
Deniz
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-18 22:58 how to set c-set-style at startup? Jai Dayal
2011-07-18 23:17 ` Deniz Dogan
@ 2011-07-19 5:03 ` Peter Münster
2011-07-20 2:34 ` Jai Dayal
1 sibling, 1 reply; 7+ messages in thread
From: Peter Münster @ 2011-07-19 5:03 UTC (permalink / raw)
To: help-gnu-emacs
On Tue, Jul 19 2011, Jai Dayal wrote:
> It seems right now, I have to do c-set-style for each file/buffer I open.
> Is there a way I can set this in my .emacs file so that all files will have
> the same c style indentation?
Without customize:
--8<---------------cut here---------------start------------->8---
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "linux")
... ; other settings
))
--8<---------------cut here---------------end--------------->8---
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-19 5:03 ` Peter Münster
@ 2011-07-20 2:34 ` Jai Dayal
2011-07-20 5:30 ` Andreas Röhler
2011-07-20 7:15 ` Peter Münster
0 siblings, 2 replies; 7+ messages in thread
From: Jai Dayal @ 2011-07-20 2:34 UTC (permalink / raw)
To: Peter Münster; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
I tried this, but it doesn't seem to be working. For example, I change the
style to the style I have in the code below, and the indentation will be
different. I can also put in garbage instead of "linux" and no errors
occur.
Maybe I'm missing something?
On Mon, Jul 18, 2011 at 11:03 PM, Peter Münster <pmlists@free.fr> wrote:
> On Tue, Jul 19 2011, Jai Dayal wrote:
>
> > It seems right now, I have to do c-set-style for each file/buffer I
> open.
> > Is there a way I can set this in my .emacs file so that all files will
> have
> > the same c style indentation?
>
> Without customize:
>
> --8<---------------cut here---------------start------------->8---
> (add-hook 'c-mode-hook
> '(lambda ()
> (c-set-style "linux")
> ... ; other settings
> ))
> --8<---------------cut here---------------end--------------->8---
>
> --
> Peter
>
>
>
[-- Attachment #2: Type: text/html, Size: 1339 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-20 2:34 ` Jai Dayal
@ 2011-07-20 5:30 ` Andreas Röhler
2011-07-20 7:15 ` Peter Münster
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2011-07-20 5:30 UTC (permalink / raw)
To: help-gnu-emacs
Am 20.07.2011 04:34, schrieb Jai Dayal:
> I tried this, but it doesn't seem to be working. For example, I change the
> style to the style I have in the code below, and the indentation will be
> different. I can also put in garbage instead of "linux" and no errors
> occur.
>
> Maybe I'm missing something?
>
> On Mon, Jul 18, 2011 at 11:03 PM, Peter Münster<pmlists@free.fr> wrote:
>
>> On Tue, Jul 19 2011, Jai Dayal wrote:
>>
>>> It seems right now, I have to do c-set-style for each file/buffer I
>> open.
>>> Is there a way I can set this in my .emacs file so that all files will
>> have
>>> the same c style indentation?
>>
>> Without customize:
>>
>> --8<---------------cut here---------------start------------->8---
>> (add-hook 'c-mode-hook
>> '(lambda ()
>> (c-set-style "linux")
>> ... ; other settings
>> ))
>> --8<---------------cut here---------------end--------------->8---
>>
>> --
>> Peter
>>
>>
>>
>
Emacs' c-modes have it's own lists.
Please consider a post onto bug-cc-mode@gnu.org
cheers,
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-20 2:34 ` Jai Dayal
2011-07-20 5:30 ` Andreas Röhler
@ 2011-07-20 7:15 ` Peter Münster
2011-07-20 16:12 ` Jai Dayal
1 sibling, 1 reply; 7+ messages in thread
From: Peter Münster @ 2011-07-20 7:15 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, Jul 20 2011, Jai Dayal wrote:
> I tried this, but it doesn't seem to be working.
Example? Emacs-version?
This works for me:
emacs -Q
M-: (add-hook 'c-mode-hook '(lambda () (c-set-style "linux")))
open "foo.c"
C-h v c-indentation-style
-> result = "linux"
> For example, I change the
> style to the style I have in the code below, and the indentation will be
> different.
To be expected, isn't it?
> I can also put in garbage instead of "linux" and no errors occur.
I get "Undefined style: garbage" in the *Messages* buffer.
--
Peter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: how to set c-set-style at startup?
2011-07-20 7:15 ` Peter Münster
@ 2011-07-20 16:12 ` Jai Dayal
0 siblings, 0 replies; 7+ messages in thread
From: Jai Dayal @ 2011-07-20 16:12 UTC (permalink / raw)
To: Peter Münster; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]
Hi,
Thanks for your help! I tried that, and for indentation style, it
displayed "gnu". I didn't see any errors in the Messages list.
From here: http://www.emacswiki.org/emacs/IndentingC#toc1
I found this:
(setq c-default-style "linux"
c-basic-offset 4)
That seemed to work for me. I have emacs 23.3.1. Anyways, you set me on
the right track.
Thank you!
On Wed, Jul 20, 2011 at 1:15 AM, Peter Münster <pmlists@free.fr> wrote:
> On Wed, Jul 20 2011, Jai Dayal wrote:
>
> > I tried this, but it doesn't seem to be working.
>
> Example? Emacs-version?
>
> This works for me:
>
> emacs -Q
> M-: (add-hook 'c-mode-hook '(lambda () (c-set-style "linux")))
> open "foo.c"
> C-h v c-indentation-style
> -> result = "linux"
>
>
> > For example, I change the
> > style to the style I have in the code below, and the indentation will be
> > different.
>
> To be expected, isn't it?
>
>
> > I can also put in garbage instead of "linux" and no errors occur.
>
> I get "Undefined style: garbage" in the *Messages* buffer.
>
> --
> Peter
>
>
>
[-- Attachment #2: Type: text/html, Size: 1742 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-07-20 16:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-18 22:58 how to set c-set-style at startup? Jai Dayal
2011-07-18 23:17 ` Deniz Dogan
2011-07-19 5:03 ` Peter Münster
2011-07-20 2:34 ` Jai Dayal
2011-07-20 5:30 ` Andreas Röhler
2011-07-20 7:15 ` Peter Münster
2011-07-20 16:12 ` Jai Dayal
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).