Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8dc8f44f
Commit
8dc8f44f
authored
Sep 07, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Emacs/vim editor info.
parent
c84db61c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
40 deletions
+103
-40
doc/src/FAQ/FAQ_DEV.html
doc/src/FAQ/FAQ_DEV.html
+1
-1
doc/src/sgml/sources.sgml
doc/src/sgml/sources.sgml
+6
-39
src/tools/editors/emacs.samples
src/tools/editors/emacs.samples
+78
-0
src/tools/editors/vim.samples
src/tools/editors/vim.samples
+18
-0
No files found.
doc/src/FAQ/FAQ_DEV.html
View file @
8dc8f44f
...
@@ -370,7 +370,7 @@
...
@@ -370,7 +370,7 @@
less:
less:
less -x4
less -x4
</PRE>
</PRE>
<P>
The
<I>
tools
</I>
directory of the latest sources contains sample
<P>
The
<I>
tools
/editors
</I>
directory of the latest sources contains sample
settings that can be used with the
<I>
emacs, xemacs
</I>
and
<I>
vim
</I>
settings that can be used with the
<I>
emacs, xemacs
</I>
and
<I>
vim
</I>
editors, that assist in keeping to PostgreSQL coding standards.
editors, that assist in keeping to PostgreSQL coding standards.
</P>
</P>
...
...
doc/src/sgml/sources.sgml
View file @
8dc8f44f
<!-- $PostgreSQL: pgsql/doc/src/sgml/sources.sgml,v 2.1
7 2006/03/10 19:10:49
momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/sources.sgml,v 2.1
8 2006/09/07 00:10:46
momjian Exp $ -->
<chapter id="source">
<chapter id="source">
<title>PostgreSQL Coding Conventions</title>
<title>PostgreSQL Coding Conventions</title>
...
@@ -21,44 +21,11 @@
...
@@ -21,44 +21,11 @@
</para>
</para>
<para>
<para>
For <productname>Emacs</productname>, add the following (or
The <filename>src/tools</filename> directory contains sample settings
something similar) to your <filename>~/.emacs</filename>
files that can be used with the <productname>emacs</productname>,
initialization file:
<productname>xemacs</productname> or <productname>vim</productname>
editors to help ensure that they format code according to these
<programlisting>
conventions.
;; 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 <application>vi</application>, try
<programlisting>
:set ts=4
</programlisting>
</para>
</para>
<para>
<para>
...
...
src/tools/editors/emacs.samples
0 → 100644
View file @
8dc8f44f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; This file contains several examples of how to set up emacs and/or xemacs
;;; to edit PostgreSQL code.
;;;
;;; Whichever set you choose would go in your .emacs file or equivalent.
;;;
;;; You only need one of these.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This set is known to work with old versions of emacs
(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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Similar approach, known to work with xemacs
;;; Use of a named style makes it easy to use the style elsewhere
(c-add-style "pgsql"
'("bsd"
(indent-tabs-mode . t)
(c-basic-offset . 4)
(tab-width . 4)
(c-offsets-alist .
((case-label . +)))
)
nil ) ; t = set this mode, nil = don't
(defun pgsql-c-mode ()
(c-mode)
(c-set-style "pgsql")
)
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.[chyl]\\'" . pgsql-c-mode)
auto-mode-alist))
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode)
auto-mode-alist))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Slightly different approach - use a hook instead of a mode
(add-hook 'c-mode-hook
(function
(lambda nil
(if (string-match "pgsql" buffer-file-name)
(progn
(c-set-style "bsd")
(setq c-basic-offset 4)
(setq tab-width 4)
(c-set-offset 'case-label '+)
(setq indent-tabs-mode t)
)
))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
src/tools/editors/vim.samples
0 → 100644
View file @
8dc8f44f
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" These settings are appropriate for editing PostgreSQL code with vim
"
" You would copy this into your .vimrc or equivalent
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:if match(getcwd(), "/pgsql") >=0 || match(getcwd(), "/postgresql") >= 0
: set cinoptions=(0
: set tabstop=4
: set shiftwidth=4
:endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment