From 96107f326e575288000058ce3ab57bfd07a950a0 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 17 Sep 2024 14:16:47 +0300 Subject: [PATCH] Add .editorconfig and .dir-locals.el This makes the formatting right in editors, and in github diff view. The files are copied verbatim from PostgreSQL; we want the same formatting. --- .dir-locals.el | 21 +++++++++++++++++++++ .editorconfig | 16 ++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .dir-locals.el create mode 100644 .editorconfig diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..3daac1c --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,21 @@ +;; Copied from PostgreSQL sources, for same formatting. + +;; see also src/tools/editors/emacs.samples for more complete settings + +((c-mode . ((c-basic-offset . 4) + (c-file-style . "bsd") + (fill-column . 78) + (indent-tabs-mode . t) + (tab-width . 4))) + (nxml-mode . ((fill-column . 78) + (indent-tabs-mode . nil))) + (perl-mode . ((perl-indent-level . 4) + (perl-continued-statement-offset . 2) + (perl-continued-brace-offset . -2) + (perl-brace-offset . 0) + (perl-brace-imaginary-offset . 0) + (perl-label-offset . -2) + (indent-tabs-mode . t) + (tab-width . 4))) + (sgml-mode . ((fill-column . 78) + (indent-tabs-mode . nil)))) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..05a1a68 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# Copied from PostgreSQL sources, for same formatting. + +root = true + +[*.{c,h,l,y,pl,pm}] +indent_style = tab +indent_size = tab +tab_width = 4 + +[*.{sgml,xml}] +indent_style = space +indent_size = 1 + +[*.xsl] +indent_style = space +indent_size = 2