diff options
author | Jim Meyering <meyering@redhat.com> | 2009-08-03 10:55:34 -0400 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-08-03 18:05:17 +0200 |
commit | 4c2c2793bad56ce05caf6244e10fd5bcd7023383 (patch) | |
tree | d0de866a7f232fa6f9227af4ffec6285457665d3 /HACKING | |
parent | 2f1a50d81671810256dce0852e6b1e0810ac44af (diff) | |
download | libguestfs-4c2c2793bad56ce05caf6244e10fd5bcd7023383.tar.gz libguestfs-4c2c2793bad56ce05caf6244e10fd5bcd7023383.tar.xz libguestfs-4c2c2793bad56ce05caf6244e10fd5bcd7023383.zip |
Document and enforce the new spaces-only indentation policy.
* cfg.mk (disable_temporarily): Remove sc_TAB_in_indentation,
to enable the "make syntax-check" that enforces this.
* .x-sc_TAB_in_indentation: New file. Exceptions.
* HACKING: Document the policy, with tips on how to conform.
Diffstat (limited to 'HACKING')
-rw-r--r-- | HACKING | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -24,6 +24,29 @@ Please make sure that the code compiles without warnings. Please test any changes. +Code indentation +---------------------------------------------------------------------- +Our C source code generally adheres to some basic code-formatting +conventions. The existing code base is not totally consistent on this +front, but we do prefer that contributed code be formatted similarly. +In short, use spaces-not-TABs for indentation, use 2 spaces for each +indentation level, and other than that, follow the K&R style. + +If you use Emacs, add the following to one of one of your start-up files +(e.g., ~/.emacs), to help ensure that you get indentation right: + + ;;; When editing C sources in libguestfs, use this style. + (defun libguestfs-c-mode () + "C mode with adjusted defaults for use with libguestfs." + (interactive) + (c-set-style "K&R") + (setq indent-tabs-mode nil) ; indent using spaces, not TABs + (setq c-indent-level 2) + (setq c-basic-offset 2)) + (add-hook 'c-mode-hook + '(lambda () (if (string-match "/libguestfs" (buffer-file-name)) + (libguestfs-c-mode)))) + Directories ---------------------------------------------------------------------- |