diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-11-15 09:22:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-11-23 10:43:22 +0100 |
commit | d95d0b1b7249172dafbd09509c3b97b7b4d5077a (patch) | |
tree | 1035337affb8ea58a338199856efc3224cf78dd8 /doc | |
parent | 9177556bb949376685da515e3803a0be56fe6cce (diff) |
doc/developer.texi: move editor configuration under formatting
It logically belongs there.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/developer.texi | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/doc/developer.texi b/doc/developer.texi index 01735e07f5..084cf6c155 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -108,6 +108,40 @@ The presentation is one inspired by 'indent -i4 -kr -nut'. The main priority in FFmpeg is simplicity and small code size in order to minimize the bug count. +@subsection Vim configuration +In order to configure Vim to follow FFmpeg formatting conventions, paste +the following snippet into your @file{.vimrc}: +@example +" indentation rules for FFmpeg: 4 spaces, no tabs +set expandtab +set shiftwidth=4 +set softtabstop=4 +set cindent +set cinoptions=(0 +" Allow tabs in Makefiles. +autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8 +" Trailing whitespace and tabs are forbidden, so highlight them. +highlight ForbiddenWhitespace ctermbg=red guibg=red +match ForbiddenWhitespace /\s\+$\|\t/ +" Do not highlight spaces at the end of line while typing on that line. +autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/ +@end example + +@subsection Emacs configuration +For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: +@lisp +(c-add-style "ffmpeg" + '("k&r" + (c-basic-offset . 4) + (indent-tabs-mode . nil) + (show-trailing-whitespace . t) + (c-offsets-alist + (statement-cont . (c-lineup-assignments +))) + ) + ) +(setq c-default-style "ffmpeg") +@end lisp + @section Comments Use the JavaDoc/Doxygen format (see examples below) so that code documentation can be generated automatically. All nontrivial functions should have a comment @@ -204,39 +238,6 @@ Casts should be used only when necessary. Unneeded parentheses should also be avoided if they don't make the code easier to understand. @end itemize -@section Editor configuration -In order to configure Vim to follow FFmpeg formatting conventions, paste -the following snippet into your @file{.vimrc}: -@example -" indentation rules for FFmpeg: 4 spaces, no tabs -set expandtab -set shiftwidth=4 -set softtabstop=4 -set cindent -set cinoptions=(0 -" Allow tabs in Makefiles. -autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8 -" Trailing whitespace and tabs are forbidden, so highlight them. -highlight ForbiddenWhitespace ctermbg=red guibg=red -match ForbiddenWhitespace /\s\+$\|\t/ -" Do not highlight spaces at the end of line while typing on that line. -autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/ -@end example - -For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: -@lisp -(c-add-style "ffmpeg" - '("k&r" - (c-basic-offset . 4) - (indent-tabs-mode . nil) - (show-trailing-whitespace . t) - (c-offsets-alist - (statement-cont . (c-lineup-assignments +))) - ) - ) -(setq c-default-style "ffmpeg") -@end lisp - @anchor{Development Policy} @chapter Development Policy |