[webkit-dev] Emacs vs. WebKit coding style (was Re: Point 3 of the WebKit Style Guidelines)

Mark Rowe mrowe at apple.com
Tue Sep 22 18:31:37 PDT 2009


On 2009-09-22, at 18:24, Maciej Stachowiak wrote:

>
> On Sep 22, 2009, at 5:45 PM, David Levin wrote:
>
>>
>>
>> On Tue, Sep 22, 2009 at 5:37 PM, Maciej Stachowiak <mjs at apple.com>  
>> wrote:
>>
>> On Sep 22, 2009, at 1:06 PM, David Hyatt wrote:
>>
>> I had thought that we resolved ages ago that we would no longer be  
>> indenting code inside namespaces in header files, since that just  
>> results in the entire class declaration being pointlessly indented.
>>
>> This is point 3 on the page:
>>
>> http://webkit.org/coding/coding-style.html
>>
>> I'd like to reverse the Right and Wrong examples to fix this.
>>
>> Are there any objections to this change?  I know a few months ago,  
>> people agreed (notably Maciej) that there was no longer any point  
>> to essentially indenting the entire file's contents (when we  
>> already don't do this in .cpp files).
>>
>> I like this change (even though it's hard to make Emacs play along).
>>
>> Is there a way to get Emacs to auto-indent this correctly? :'(
>
> There probably is, but it may be beyond my elisp skills. Here is my  
> current .emacs attempt to get something close to WebKit style (and  
> also to avoid putting tabs in ChangeLogs):
>
> (defun my-c-mode-hook ()
>   (setq c-basic-offset 4)
>   (setq tab-width 8)
>   (setq indent-tabs-mode nil)
>   (c-set-offset 'substatement-open 0))
>
> (add-hook 'c-mode-common-hook 'my-c-mode-hook)
>
> (defun my-change-log-mode-hook ()
>   (setq tab-width 8)
>   (setq indent-tabs-mode nil))
>
> (add-hook 'change-log-mode-hook 'my-change-log-mode-hook)

I think (c-set-offset 'innamespace 0) will do the trick.

- Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090922/27801f84/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3166 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090922/27801f84/attachment.bin>


More information about the webkit-dev mailing list