]> granicus.if.org Git - postgresql/blob - doc/src/sgml/sources.sgml
Minor markup changes. Refer to (".../catalog") in the emacs hints.
[postgresql] / doc / src / sgml / sources.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.2 2000/03/31 03:27:41 thomas Exp $
3 -->
4
5  <chapter>
6   <title>Postgres Source Code</title>
7
8   <sect1>
9    <title>Formatting</title>
10
11    <para>
12     Source code formatting uses a 4 column tab spacing, currently with 
13     tabs preserved (i.e. tabs are not expanded to spaces).
14    </para>
15
16    <para>
17     For emacs, add the following (or something similar)
18     to your <filename>~/.emacs</filename> 
19     initialization file:
20
21     <programlisting>
22 ;; check for files with a path containing "postgres" or "pgsql"
23 (setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.[ch]\\'" . pgsql-c-mode) auto-mode-alist))
24 (setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode) auto-mode-alist))
25
26 (defun pgsql-c-mode ()
27   ;; sets up formatting for Postgres C code
28   (interactive)
29   (c-mode)
30   (setq-default tab-width 4)
31   (c-set-style "bsd")             ; set c-basic-offset to 4, plus other stuff
32   (c-set-offset 'case-label '+)   ; tweak case indent to match PG custom
33   (setq indent-tabs-mode t))      ; make sure we keep tabs when indenting
34     </programlisting>
35    </para>
36
37    <para>
38     For <application>vi</application>, your
39     <filename>~/.vimrc</filename> or equivalent file should contain
40     the following:
41
42     <programlisting>
43 set tabstop=4
44     </programlisting>
45
46     or equivalently from within vi, try
47
48     <programlisting>
49 :set ts=4
50     </programlisting>
51    </para>
52
53    <para>
54     The text browsing tools <application>more</application> and
55     <application>less</application> can be invoked as
56
57     <programlisting>
58 more -x4
59 less -x4
60     </programlisting>
61    </para>
62   </sect1>
63  </chapter>
64
65 <!-- Keep this comment at the end of the file
66 Local variables:
67 mode:sgml
68 sgml-omittag:nil
69 sgml-shorttag:t
70 sgml-minimize-attributes:nil
71 sgml-always-quote-attributes:t
72 sgml-indent-step:1
73 sgml-indent-data:t
74 sgml-parent-document:nil
75 sgml-default-dtd-file:"./reference.ced"
76 sgml-exposed-tags:nil
77 sgml-local-catalogs:("/usr/lib/sgml/catalog")
78 sgml-local-ecat-files:nil
79 End:
80 -->