From: Peter Eisentraut Date: Fri, 13 Jul 2018 19:23:41 +0000 (+0200) Subject: Update documentation editor setup instructions X-Git-Tag: REL_11_BETA3~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc4e355f013d6122e4ae17fa99e9db20babbb86a;p=postgresql Update documentation editor setup instructions Now that the documentation sources are in XML rather than SGML, some of the documentation about the editor, or more specifically Emacs, setup needs updating. The updated instructions recommend using nxml-mode, which works mostly out of the box, with some small tweaks in emacs.samples and .dir-locals.el. Also remove some obsolete stuff in .dir-locals.el. I did, however, leave the sgml-mode settings in there so that someone using Emacs without emacs.samples gets those settings when editing a *.sgml file. --- diff --git a/.dir-locals.el b/.dir-locals.el index 9525d6b604..eff4671ef8 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -5,8 +5,8 @@ (fill-column . 78) (indent-tabs-mode . t) (tab-width . 4))) - (dsssl-mode . ((indent-tabs-mode . nil))) - (nxml-mode . ((indent-tabs-mode . nil))) + (nxml-mode . ((fill-column . 78) + (indent-tabs-mode . nil))) (perl-mode . ((perl-indent-level . 4) (perl-continued-statement-offset . 2) (perl-continued-brace-offset . 4) diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml index b4338e0e73..21bb429745 100644 --- a/doc/src/sgml/docguide.sgml +++ b/doc/src/sgml/docguide.sgml @@ -393,112 +393,36 @@ ADDITIONAL_FLAGS='-Xmx1500m' Documentation Authoring - SGML and DocBook do - not suffer from an oversupply of open-source authoring tools. The - most common tool set is the - Emacs/XEmacs - editor with appropriate editing mode. On some systems - these tools are provided in a typical full installation. + The documentation sources are most conveniently modified with an editor + that has a mode for editing XML, and even more so if it has some awareness + of XML schema languages so that it can know about + DocBook syntax specifically. - - Emacs/PSGML - - - PSGML is the most common and most - powerful mode for editing SGML documents. - When properly configured, it will allow you to use - Emacs to insert tags and check markup - consistency. You could use it for HTML as - well. Check the - PSGML web site for downloads, installation instructions, and - detailed documentation. - - - - There is one important thing to note with - PSGML: its author assumed that your - main SGML DTD directory - would be /usr/local/lib/sgml. If, as in the - examples in this chapter, you use - /usr/local/share/sgml, you have to - compensate for this, either by setting - SGML_CATALOG_FILES environment variable, or you - can customize your PSGML installation - (its manual tells you how). - - - - Put the following in your ~/.emacs - environment file (adjusting the path names to be appropriate for - your system): - - -; ********** for SGML mode (psgml) - -(setq sgml-omittag t) -(setq sgml-shorttag t) -(setq sgml-minimize-attributes nil) -(setq sgml-always-quote-attributes t) -(setq sgml-indent-step 1) -(setq sgml-indent-data t) -(setq sgml-parent-document nil) -(setq sgml-exposed-tags nil) -(setq sgml-catalog-files '("/usr/local/share/sgml/catalog")) - -(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t ) - - - and in the same file add an entry for SGML - into the (existing) definition for - auto-mode-alist: - -(setq - auto-mode-alist - '(("\\.sgml$" . sgml-mode) - )) - - - - - You might find that when using PSGML, a - comfortable way of working with these separate files of book - parts is to insert a proper DOCTYPE - declaration while you're editing them. If you are working on - this source, for instance, it is an appendix chapter, so you - would specify the document as an appendix instance - of a DocBook document by making the first line look like this: - - -<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN"> - - - This means that anything and everything that reads - SGML will get it right, and I can verify the - document with nsgmls -s docguide.sgml. (But - you need to take out that line before building the entire - documentation set.) - - + + Note that for historical reasons the documentation source files are named + with an extension .sgml even though they are now XML + files. So you might need to adjust your editor configuration to set the + correct mode. + - Other Emacs Modes + Emacs - GNU Emacs ships with a different - SGML mode, which is not quite as powerful as - PSGML, but it's less confusing and - lighter weight. Also, it offers syntax highlighting (font lock), - which can be very helpful. - src/tools/editors/emacs.samples contains - sample settings for this mode. + nXML Mode, which ships with + Emacs, is the most common mode for editing + XML documents with Emacs. + It will allow you to use Emacs to insert tags + and check markup consistency, and it supports + DocBook out of the box. Check the + nXML manual for detailed documentation. - Norm Walsh offers a - major mode - specifically for DocBook which also has font-lock and a number of features to - reduce typing. + src/tools/editors/emacs.samples contains + recommended settings for this mode. diff --git a/src/tools/editors/emacs.samples b/src/tools/editors/emacs.samples index 5f08c71dd1..a7152b04bc 100644 --- a/src/tools/editors/emacs.samples +++ b/src/tools/editors/emacs.samples @@ -62,12 +62,23 @@ ;;; documentation files -(add-hook 'sgml-mode-hook - (defun postgresql-sgml-mode-hook () +;; *.sgml files are actually XML +(add-to-list 'auto-mode-alist '("/postgres\\(ql\\)?/.*\\.sgml\\'" . nxml-mode)) + +(add-hook 'nxml-mode-hook + (defun postgresql-xml-mode-hook () (when (string-match "/postgres\\(ql\\)?/" buffer-file-name) (setq fill-column 78) - (setq indent-tabs-mode nil) - (setq sgml-basic-offset 1)))) + (setq indent-tabs-mode nil)))) + +;; The *.xsl files use 2-space indent, which is consistent with +;; docbook-xsl sources and also the nxml-mode default. But the *.sgml +;; files use 1-space indent, mostly for historical reasons at this +;; point. +(add-hook 'nxml-mode-hook + (defun postgresql-xml-src-mode-hook () + (when (string-match "/postgres\\(ql\\)?/.*\\.sgml\\'" buffer-file-name) + (setq nxml-child-indent 1)))) ;;; Makefiles