lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <497DE701.5050005@oracle.com>
Date:	Mon, 26 Jan 2009 08:38:25 -0800
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	Teemu Likonen <tlikonen@....fi>
CC:	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Johannes Weiner <hannes@...urebad.de>,
	Dan Carpenter <error27@...il.com>
Subject: Re: [PATCH] Documentation: update CodingStyle tips for Emacs users

Teemu Likonen wrote:
> Teemu Likonen (2009-01-18 19:18 +0200) wrote:
> 
>> With the previous Emacs tips example the kernel style was made available
>> for files in the kernel-tree only. This patch updates the tip to add
>> separate cc-mode indent style; it makes the kernel style easily
>> available for any filetype mode that is managed by the Emacs cc-mode.
>>
>> We also fix the filename regexp in the example: Elisp function
>> buffer-file-name returns full pathname, not a path relative to user's
>> home directory. Hence a tilde (~) can't be used to refer to home
>> directory (as the previous code did).
>>
>> Signed-off-by: Teemu Likonen <tlikonen@....fi>
>> ---
>>  Documentation/CodingStyle |   19 +++++++++++++------
>>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> 
> Exactly what I expected: nobody pays any attention. :-) Well, it's not a
> problem, I'm not even a kernel coder. I just happen to think that this
> patch introduces the right way to configure Emacs for kernel coding
> style. Adding a custom style like this ("linux-tabs-only") makes it much
> easier to switch between different indent styles and also to use the
> kernel style elsewhere.
> 
> So, I'll just ping the lists and maintainers this one more time to see
> if someone is interested. Here's my original message:
> 
>     http://article.gmane.org/gmane.linux.documentation/442
> 

OK, I see it.  I'm not an emacs user and I have no idea how correct
the patch is.

There is another emacs CodingStyle patch from Dan Carpenter that
expands the "~" part of the filename to the user directory:
see http://lkml.org/lkml/2009/1/21/62

so I would be tempted to merge/apply both patches.

Any other comments on these patches?

> 
>> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
>> index 1875e50..2cda242 100644
>> --- a/Documentation/CodingStyle
>> +++ b/Documentation/CodingStyle
>> @@ -483,20 +483,27 @@ values.  To do the latter, you can stick the following in your .emacs file:
>>      (* (max steps 1)
>>         c-basic-offset)))
>>  
>> +(add-hook 'c-mode-common-hook
>> +          (lambda ()
>> +            ;; Add kernel style
>> +            (c-add-style
>> +             "linux-tabs-only"
>> +             '("linux" (c-offsets-alist
>> +                        (arglist-cont-nonempty
>> +                         c-lineup-gcc-asm-reg
>> +                         c-lineup-arglist-tabs-only))))))
>> +
>>  (add-hook 'c-mode-hook
>>            (lambda ()
>>              (let ((filename (buffer-file-name)))
>>                ;; Enable kernel mode for the appropriate files
>>                (when (and filename
>> -                         (string-match "~/src/linux-trees" filename))
>> +                         (string-match "src/linux-trees" filename))
>>                  (setq indent-tabs-mode t)
>> -                (c-set-style "linux")
>> -                (c-set-offset 'arglist-cont-nonempty
>> -                              '(c-lineup-gcc-asm-reg
>> -                                c-lineup-arglist-tabs-only))))))
>> +                (c-set-style "linux-tabs-only")))))
>>  
>>  This will make emacs go better with the kernel coding style for C
>> -files below ~/src/linux-trees.
>> +files which pathname matches src/linux-trees.
>>  
>>  But even if you fail in getting emacs to do sane formatting, not
>>  everything is lost: use "indent".
>> -- 

Thanks.
-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ