blob: c07264e5dba522c49b352e1858b56618096c7056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.6 2002/01/20 22:19:56 petere Exp $
-->
<chapter id="source">
<title>PostgreSQL Source Code</title>
<sect1 id="source-format">
<title>Formatting</title>
<para>
Source code formatting uses a 4 column tab spacing, currently with
tabs preserved (i.e. tabs are not expanded to spaces).
</para>
<para>
For Emacs, add the following (or something similar)
to your <filename>~/.emacs</filename>
initialization file:
<programlisting>
;; 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 PostgreSQL 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
</programlisting>
</para>
<para>
For <application>vi</application>, your
<filename>~/.vimrc</filename> or equivalent file should contain
the following:
<programlisting>
set tabstop=4
</programlisting>
or equivalently from within vi, try
<programlisting>
:set ts=4
</programlisting>
</para>
<para>
The text browsing tools <application>more</application> and
<application>less</application> can be invoked as
<programlisting>
more -x4
less -x4
</programlisting>
</para>
</sect1>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode:sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"./reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:("/usr/lib/sgml/catalog")
sgml-local-ecat-files:nil
End:
-->
|