Skip to content

Commit 333224c

Browse files
committed
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.
1 parent 4984784 commit 333224c

File tree

3 files changed

+38
-103
lines changed

3 files changed

+38
-103
lines changed

.dir-locals.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
(fill-column . 78)
66
(indent-tabs-mode . t)
77
(tab-width . 4)))
8-
(dsssl-mode . ((indent-tabs-mode . nil)))
9-
(nxml-mode . ((indent-tabs-mode . nil)))
8+
(nxml-mode . ((fill-column . 78)
9+
(indent-tabs-mode . nil)))
1010
(perl-mode . ((perl-indent-level . 4)
1111
(perl-continued-statement-offset . 2)
1212
(perl-continued-brace-offset . 4)

doc/src/sgml/docguide.sgml

+21-97
Original file line numberDiff line numberDiff line change
@@ -393,112 +393,36 @@ ADDITIONAL_FLAGS='-Xmx1500m'
393393
<title>Documentation Authoring</title>
394394

395395
<para>
396-
<acronym>SGML</acronym> and <productname>DocBook</productname> do
397-
not suffer from an oversupply of open-source authoring tools. The
398-
most common tool set is the
399-
<productname>Emacs</productname>/<productname>XEmacs</productname>
400-
editor with appropriate editing mode. On some systems
401-
these tools are provided in a typical full installation.
396+
The documentation sources are most conveniently modified with an editor
397+
that has a mode for editing XML, and even more so if it has some awareness
398+
of XML schema languages so that it can know about
399+
<productname>DocBook</productname> syntax specifically.
402400
</para>
403401

404-
<sect2>
405-
<title>Emacs/PSGML</title>
406-
407-
<para>
408-
<productname>PSGML</productname> is the most common and most
409-
powerful mode for editing <acronym>SGML</acronym> documents.
410-
When properly configured, it will allow you to use
411-
<application>Emacs</application> to insert tags and check markup
412-
consistency. You could use it for <acronym>HTML</acronym> as
413-
well. Check the <ulink url="http://www.lysator.liu.se/projects/about_psgml.html">
414-
PSGML web site</ulink> for downloads, installation instructions, and
415-
detailed documentation.
416-
</para>
417-
418-
<para>
419-
There is one important thing to note with
420-
<productname>PSGML</productname>: its author assumed that your
421-
main <acronym>SGML</acronym> <acronym>DTD</acronym> directory
422-
would be <filename>/usr/local/lib/sgml</filename>. If, as in the
423-
examples in this chapter, you use
424-
<filename>/usr/local/share/sgml</filename>, you have to
425-
compensate for this, either by setting
426-
<envar>SGML_CATALOG_FILES</envar> environment variable, or you
427-
can customize your <productname>PSGML</productname> installation
428-
(its manual tells you how).
429-
</para>
430-
431-
<para>
432-
Put the following in your <filename>~/.emacs</filename>
433-
environment file (adjusting the path names to be appropriate for
434-
your system):
435-
436-
<programlisting>
437-
; ********** for SGML mode (psgml)
438-
439-
(setq sgml-omittag t)
440-
(setq sgml-shorttag t)
441-
(setq sgml-minimize-attributes nil)
442-
(setq sgml-always-quote-attributes t)
443-
(setq sgml-indent-step 1)
444-
(setq sgml-indent-data t)
445-
(setq sgml-parent-document nil)
446-
(setq sgml-exposed-tags nil)
447-
(setq sgml-catalog-files '("/usr/local/share/sgml/catalog"))
448-
449-
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t )
450-
</programlisting>
451-
452-
and in the same file add an entry for <acronym>SGML</acronym>
453-
into the (existing) definition for
454-
<varname>auto-mode-alist</varname>:
455-
<programlisting>
456-
(setq
457-
auto-mode-alist
458-
'(("\\.sgml$" . sgml-mode)
459-
))
460-
</programlisting>
461-
</para>
462-
463-
<para>
464-
You might find that when using <productname>PSGML</productname>, a
465-
comfortable way of working with these separate files of book
466-
parts is to insert a proper <literal>DOCTYPE</literal>
467-
declaration while you're editing them. If you are working on
468-
this source, for instance, it is an appendix chapter, so you
469-
would specify the document as an <quote>appendix</quote> instance
470-
of a DocBook document by making the first line look like this:
471-
472-
<programlisting>
473-
&lt;!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN"&gt;
474-
</programlisting>
475-
476-
This means that anything and everything that reads
477-
<acronym>SGML</acronym> will get it right, and I can verify the
478-
document with <command>nsgmls -s docguide.sgml</command>. (But
479-
you need to take out that line before building the entire
480-
documentation set.)
481-
</para>
482-
</sect2>
402+
<para>
403+
Note that for historical reasons the documentation source files are named
404+
with an extension <filename>.sgml</filename> even though they are now XML
405+
files. So you might need to adjust your editor configuration to set the
406+
correct mode.
407+
</para>
483408

484409
<sect2>
485-
<title>Other Emacs Modes</title>
410+
<title>Emacs</title>
486411

487412
<para>
488-
<productname>GNU Emacs</productname> ships with a different
489-
<acronym>SGML</acronym> mode, which is not quite as powerful as
490-
<productname>PSGML</productname>, but it's less confusing and
491-
lighter weight. Also, it offers syntax highlighting (font lock),
492-
which can be very helpful.
493-
<filename>src/tools/editors/emacs.samples</filename> contains
494-
sample settings for this mode.
413+
<productname>nXML Mode</productname>, which ships with
414+
<productname>Emacs</productname>, is the most common mode for editing
415+
<acronym>XML</acronym> documents with <productname>Emacs</productname>.
416+
It will allow you to use <application>Emacs</application> to insert tags
417+
and check markup consistency, and it supports
418+
<productname>DocBook</productname> out of the box. Check the <ulink
419+
url="https://www.gnu.org/software/emacs/manual/html_mono/nxml-mode.html">
420+
nXML manual</ulink> for detailed documentation.
495421
</para>
496422

497423
<para>
498-
Norm Walsh offers a
499-
<ulink url="http://nwalsh.com/emacs/docbookide/index.html">major mode</ulink>
500-
specifically for DocBook which also has font-lock and a number of features to
501-
reduce typing.
424+
<filename>src/tools/editors/emacs.samples</filename> contains
425+
recommended settings for this mode.
502426
</para>
503427
</sect2>
504428

src/tools/editors/emacs.samples

+15-4
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,23 @@
6262

6363
;;; documentation files
6464

65-
(add-hook 'sgml-mode-hook
66-
(defun postgresql-sgml-mode-hook ()
65+
;; *.sgml files are actually XML
66+
(add-to-list 'auto-mode-alist '("/postgres\\(ql\\)?/.*\\.sgml\\'" . nxml-mode))
67+
68+
(add-hook 'nxml-mode-hook
69+
(defun postgresql-xml-mode-hook ()
6770
(when (string-match "/postgres\\(ql\\)?/" buffer-file-name)
6871
(setq fill-column 78)
69-
(setq indent-tabs-mode nil)
70-
(setq sgml-basic-offset 1))))
72+
(setq indent-tabs-mode nil))))
73+
74+
;; The *.xsl files use 2-space indent, which is consistent with
75+
;; docbook-xsl sources and also the nxml-mode default. But the *.sgml
76+
;; files use 1-space indent, mostly for historical reasons at this
77+
;; point.
78+
(add-hook 'nxml-mode-hook
79+
(defun postgresql-xml-src-mode-hook ()
80+
(when (string-match "/postgres\\(ql\\)?/.*\\.sgml\\'" buffer-file-name)
81+
(setq nxml-child-indent 1))))
7182

7283

7384
;;; Makefiles

0 commit comments

Comments
 (0)