summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-12-10 17:20:30 -0700
committerEric Blake <ebb9@byu.net>2009-12-29 07:26:29 -0700
commita8cef71593e876b027733fdb0137ed1655cae584 (patch)
treea2ec20fa98ae39adf9d25c73c226fb46074a5162
parent180b7d19bf95d2abb21bca587a0684eca69679ad (diff)
downloadm4-a8cef71593e876b027733fdb0137ed1655cae584.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): New macro. (EXTRA_DIST): Distribute exception files, and .prev-version. Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r--.x-sc_prohibit_tab_based_indentation5
-rw-r--r--ChangeLog7
-rw-r--r--HACKING32
-rw-r--r--Makefile.am7
-rw-r--r--cfg.mk6
5 files changed, 53 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 b709552e..ba963023 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-12-29 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): New macro.
+ (EXTRA_DIST): Distribute exception files, and .prev-version.
+
Switch to indentation by space, not tab.
* .gitmodules: Convert leading tabs to spaces.
* TODO: Likewise.
diff --git a/HACKING b/HACKING
index 8f5088f0..2d287879 100644
--- a/HACKING
+++ b/HACKING
@@ -188,8 +188,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
@@ -201,8 +227,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
diff --git a/Makefile.am b/Makefile.am
index 875750f3..1d505923 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,8 +21,13 @@
## Written by Gary V. Vaughan <gary@gnu.org>
SUBDIRS = . examples lib src doc checks tests
+
+syntax_check_exceptions = \
+ .x-sc_prohibit_tab_based_indentation \
+ .x-update-copyright
+
EXTRA_DIST = bootstrap c-boxes.el cfg.mk maint.mk \
- .version m4/gnulib-cache.m4
+ .prev-version .version m4/gnulib-cache.m4 $(syntax_check_exceptions)
DISTCLEANFILES = stamp-h
## maintainer-clean should remove as much as possible that ./bootstrap can
## recreate. In the m4 directory, keep only gnulib-cache.m4.
diff --git a/cfg.mk b/cfg.mk
index 00a9e569..10fdcc52 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -33,3 +33,9 @@ config_h_header = "m4\.h"
# Hash of NEWS contents, to ensure we don't add entries to wrong section.
old_NEWS_hash = 0330971054cd4fb4e94b85fe367980f2
+
+# Indent only with spaces.
+sc_prohibit_tab_based_indentation:
+ @re='^ * ' \
+ msg='TAB in indentation; use only spaces' \
+ $(_prohibit_regexp)