summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-12-28 11:51:58 -0700
committerEric Blake <ebb9@byu.net>2010-01-05 22:03:51 -0700
commit2dd310abfba78bf2614ee8d5e9e77d95145f5e01 (patch)
tree8be74609ae000d21c82e6932c7af6d17ae3a70f8
parentcdff6b56f2f9e848722f93e45803be19609641b5 (diff)
downloadm4-2dd310abfba78bf2614ee8d5e9e77d95145f5e01.tar.gz
Document new indentation policy.
* HACKING: Document indentation policy. * .x-sc_prohibit_tab_based_indentation: New file. * cfg.mk (sc_prohibit_tab_based_indentation): New rule. * Makefile.am (syntax_check_exceptions): Ship exception. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit a8cef71593e876b027733fdb0137ed1655cae584)
-rw-r--r--.x-sc_prohibit_tab_based_indentation5
-rw-r--r--ChangeLog6
-rw-r--r--HACKING34
-rw-r--r--Makefile.am1
-rw-r--r--cfg.mk6
5 files changed, 48 insertions, 4 deletions
diff --git a/.x-sc_prohibit_tab_based_indentation b/.x-sc_prohibit_tab_based_indentation
new file mode 100644
index 00000000..bd9127ed
--- /dev/null
+++ b/.x-sc_prohibit_tab_based_indentation
@@ -0,0 +1,5 @@
+^GNUMakefile$
+Makefile\.am$
+\.mk$
+^HACKING$
+ChangeLog.*
diff --git a/ChangeLog b/ChangeLog
index f9fc18e8..6c7c9b68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2010-01-05 Eric Blake <ebb9@byu.net>
+ Document new indentation policy.
+ * HACKING: Document indentation policy.
+ * .x-sc_prohibit_tab_based_indentation: New file.
+ * cfg.mk (sc_prohibit_tab_based_indentation): New rule.
+ * Makefile.am (syntax_check_exceptions): Ship exception.
+
Switch to indentation by space, not tab.
* .gitmodules: Convert leading tabs to spaces.
* TODO: Likewise.
diff --git a/HACKING b/HACKING
index 3b9c0458..bf23427a 100644
--- a/HACKING
+++ b/HACKING
@@ -217,8 +217,34 @@ yyyy-mm-dd Name of Author <email@address> (tiny change)
* See the GNU Coding Standards document for more details on ChangeLog
formatting.
+6. Formatting
+=============
+
+* Use space-only indentation in nearly all files (Makefile and
+ ChangeLogs being the exception).
+
+ If you use Emacs and your m4 working directory name matches,
+ this code in your ~/.emacs enables the right mode:
+
+ ;; In m4, indent with spaces everywhere (not TABs).
+ ;; Exceptions: Makefile and ChangeLog modes.
+ (add-hook 'find-file-hook '(lambda ()
+ (if (and buffer-file-name
+ (string-match "/m4\\>" (buffer-file-name))
+ (not (string-equal mode-name "Change Log"))
+ (not (string-equal mode-name "Makefile")))
+ (setq indent-tabs-mode nil))))
+
+* Since the source code was massively converted from tabs in December
+ 2009, you may find it helpful to use 'git diff -w' and 'git blame -w'
+ helpful for overlooking the whitespace changes.
+
+* Avoid #ifdefs inside function bodies, whenever possible. If you
+ encounter a portability issue, it is better to propose a gnulib module
+ that works around it, and have m4 use that module.
+
-6. Release Procedure
+7. Release Procedure
====================
* If you are an m4 maintainer, but have not yet registered your
@@ -230,8 +256,8 @@ yyyy-mm-dd Name of Author <email@address> (tiny change)
preferred email address.
(b) an ASCII armored copy of your GnuPG key, as an attachment.
- ("gpg --export -a YOUR_KEY_ID > mykey.asc" should give you
- this.)
+ ("gpg --export -a YOUR_KEY_ID > mykey.asc" should give you
+ this.)
When you have received acknowledgement of your message, the proper GPG
keys will be registered on ftp-upload.gnu.org and only then will you be
@@ -312,7 +338,7 @@ yyyy-mm-dd Name of Author <email@address> (tiny change)
content that needs to be updated.
--
-Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
Foundation, Inc.
The canonical source of this file is maintained with the
diff --git a/Makefile.am b/Makefile.am
index f073c1b5..89eb7f03 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,6 +53,7 @@ include ltdl/Makefile.inc
# Additional configuration. Version management comes from suggestions
# given in build-aux/git-version-gen.
syntax_check_exceptions = \
+ .x-sc_prohibit_tab_based_indentation \
.x-sc_require_config_h \
.x-sc_require_config_h_first \
.x-update-copyright
diff --git a/cfg.mk b/cfg.mk
index 336e8b31..dd710f83 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -28,3 +28,9 @@ old_NEWS_hash = b63892a79436f9f3cd05e10c3c4657ef
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=0 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
+
+# Indent only with spaces.
+sc_prohibit_tab_based_indentation:
+ @re='^ * ' \
+ msg='TAB in indentation; use only spaces' \
+ $(_prohibit_regexp)