Skip to content

Commit 4e7bd66

Browse files
Josh TriplettLinus Torvalds
authored andcommitted
CodingStyle: add information about editor modelines
I recently received a patch including a file that had a vim modeline, and I realized that nothing specifically proscribed that practice. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a923fd6 commit 4e7bd66

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎Documentation/CodingStyle‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,33 @@ need them. Feel free to peruse that header file to see what else is already
738738
defined that you shouldn't reproduce in your code.
739739

740740

741+
Chapter 18: Editor modelines and other cruft
742+
743+
Some editors can interpret configuration information embedded in source files,
744+
indicated with special markers. For example, emacs interprets lines marked
745+
like this:
746+
747+
-*- mode: c -*-
748+
749+
Or like this:
750+
751+
/*
752+
Local Variables:
753+
compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c"
754+
End:
755+
*/
756+
757+
Vim interprets markers that look like this:
758+
759+
/* vim:set sw=8 noet */
760+
761+
Do not include any of these in source files. People have their own personal
762+
editor configurations, and your source files should not override them. This
763+
includes markers for indentation and mode configuration. People may use their
764+
own custom mode, or may have some other magic method for making indentation
765+
work correctly.
766+
767+
741768

742769
Appendix I: References
743770

0 commit comments

Comments
 (0)