Hi,
Peter Eisentraut <peter_e@gmx.net> writes:
> I think the suggested emacs configuration snippets in
> src/tools/editors/emacs.samples no longer represent current best
> practices. I have come up with some newer things that I'd like to
> propose for review.
Thanks for doing that!
> First, I propose adding a .dir-locals.el file to the top-level directory
> with basic emacs settings. These get applied automatically. This
> especially covers the particular tab and indentation settings that
> PostgreSQL uses. With this, casual developers will not need to modify
> any of their emacs settings.
I've tested that on a new git clone and with the `emacs -q` command so
as not to load any of my local setup. While the indentation seemed ok,
the placement of the comments seems way off:
Compare what you see using those commands:
emacs -q src/backend/commands/extension.c
emacs -q -l ../emacs.samples src/backend/commands/extension.c
(When using macosx, you might have to replace the 'emacs' binary
location with /Applications/Emacs.app/Contents/MacOS/Emacs).
I did also test on doc/src/sgml/extend.sgml and some Makefile, only with
using the emacs.samples file content though.
> With that, emacs.samples can be shrunk significantly. The only real
> reason to keep is that that c-offsets-alist and (more dubiously)
> sgml-basic-offset cannot be set from .dir-locals.el because they are not
> "safe". I have also removed many of the redundant examples and settled
> on a hook-based solution.
A couple of notes about your emacs.sample file:
- Name the lambda used in the hook for easier removing / reference
- A fresh git clone will create a directory named postgres, so I did
change your /postgresql/ regex to /postgres/ in my attached version
> I think together this setup would be significantly simpler and more
> practical.
Agreed.
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support