2000-03-31 05:27:42 +02:00
|
|
|
<!--
|
2001-10-09 20:46:00 +02:00
|
|
|
$Header: /cvsroot/pgsql/doc/src/sgml/sources.sgml,v 2.4 2001/10/09 18:46:00 petere Exp $
|
2000-03-31 05:27:42 +02:00
|
|
|
-->
|
|
|
|
|
2000-09-29 22:21:34 +02:00
|
|
|
<chapter id="source">
|
2000-02-02 17:25:04 +01:00
|
|
|
<title>Postgres Source Code</title>
|
|
|
|
|
2000-09-29 22:21:34 +02:00
|
|
|
<sect1 id="source-format">
|
2000-02-02 17:25:04 +01:00
|
|
|
<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:
|
|
|
|
|
2001-10-09 20:46:00 +02:00
|
|
|
<programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
;; check for files with a path containing "postgres" or "pgsql"
|
2001-10-09 20:46:00 +02:00
|
|
|
(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))
|
2000-02-02 17:25:04 +01:00
|
|
|
|
|
|
|
(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
|
2001-10-09 20:46:00 +02:00
|
|
|
</programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
For <application>vi</application>, your
|
|
|
|
<filename>~/.vimrc</filename> or equivalent file should contain
|
|
|
|
the following:
|
|
|
|
|
2001-10-09 20:46:00 +02:00
|
|
|
<programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
set tabstop=4
|
2001-10-09 20:46:00 +02:00
|
|
|
</programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
|
|
|
|
or equivalently from within vi, try
|
|
|
|
|
2001-10-09 20:46:00 +02:00
|
|
|
<programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
:set ts=4
|
2001-10-09 20:46:00 +02:00
|
|
|
</programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The text browsing tools <application>more</application> and
|
|
|
|
<application>less</application> can be invoked as
|
|
|
|
|
2001-10-09 20:46:00 +02:00
|
|
|
<programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
more -x4
|
|
|
|
less -x4
|
2001-10-09 20:46:00 +02:00
|
|
|
</programlisting>
|
2000-02-02 17:25:04 +01:00
|
|
|
</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
|
2000-03-31 05:27:42 +02:00
|
|
|
sgml-local-catalogs:("/usr/lib/sgml/catalog")
|
2000-02-02 17:25:04 +01:00
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|