Add short chapter in developer's guide on formatting source code.
authorThomas G. Lockhart
Wed, 2 Feb 2000 16:25:04 +0000 (16:25 +0000)
committerThomas G. Lockhart
Wed, 2 Feb 2000 16:25:04 +0000 (16:25 +0000)
doc/src/sgml/postgres.sgml
doc/src/sgml/programmer.sgml
doc/src/sgml/sources.sgml [new file with mode: 0644]

index 19e5c52807f5bd6fcaed20bd25854e175e8a1e27..2546ef0d79db4ec90930e3ac8480d82fe3642b6e 100644 (file)
@@ -91,6 +91,7 @@
 
 
 
+
 ]>
 
 
@@ -268,6 +269,7 @@ Your name here...
     suggestions for future development.
    
   
+   &sources;
    &arch-dev;
    &options;
    &geqo;
index f6c465af284f2e2137dc0f477eb2171d7b8d35b0..8f26bb4c3efa9205086f7f405f1b74dea81fd77a 100644 (file)
@@ -1,9 +1,12 @@
 
  
+  &sources;
   &arch-dev; 
   &options;
   &geqo;
@@ -214,7 +219,7 @@ Disable it until we put in some info.
 
 
diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
new file mode 100644 (file)
index 0000000..08a5e60
--- /dev/null
@@ -0,0 +1,76 @@
+  Postgres Source Code
+
+  
+   Formatting
+
+   
+    Source code formatting uses a 4 column tab spacing, currently with 
+    tabs preserved (i.e. tabs are not expanded to spaces).
+   
+
+   
+    For emacs, add the following (or something similar)
+    to your ~/.emacs 
+    initialization file:
+
+    
+;; check for files with a path containing "postgres" or "pgsql"
+(setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.[ch]\\'" . pgsql-c-mode) auto-mode-alist))
+(setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode) auto-mode-alist))
+
+(defun pgsql-c-mode ()
+  ;; sets up formatting for Postgres C code
+  (interactive)
+  (c-mode)
+  (setq-default tab-width 4)
+  (c-set-style "bsd")             ; set c-basic-offset to 4, plus other stuff
+  (c-set-offset 'case-label '+)   ; tweak case indent to match PG custom
+  (setq indent-tabs-mode t))      ; make sure we keep tabs when indenting
+    
+   
+
+   
+    For vi, your
+    ~/.vimrc or equivalent file should contain
+    the following:
+
+    
+set tabstop=4
+    
+
+    or equivalently from within vi, try
+
+    
+:set ts=4
+    
+   
+
+   
+    The text browsing tools more and
+    less can be invoked as
+
+    
+more -x4
+less -x4
+    
+   
+  
+
+