Update Emacs section of editor configuration chapter in FDP Primer.

PR:		211184
Submitted by:	Joseph Mingrone <jrm@ftfl.ca>
This commit is contained in:
Warren Block 2016-08-05 20:23:25 +00:00
parent 634847b8ef
commit 8ee98d74d8
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=49219

View file

@ -105,12 +105,87 @@ endfunction " Set_SGML()</programlisting>
<para>Install from
<package>editors/emacs</package>
or <package>editors/xemacs</package>.</para>
or <package>editors/emacs-devel</package>.</para>
<para>Edit <filename>~/.emacs</filename>, adding this
line:</para>
<sect2 xml:id="editor-config-emacs-validation">
<title>Validation</title>
<programlisting>(add-hook 'nxml-mode-hook 'turn-on-auto-fill)</programlisting>
<para>Emacs's nxml-mode uses compact relax NG schemas for
validating XML. A compact relax NG schema for FreeBSD's
extension to DocBook 5.0 is included in the documentation
repository. To configure nxml-mode to validate using this
schema, create
<filename>~/.emacs.d/schema/schemas.xml</filename> and add
these lines to the file:</para>
<programlisting><tag class="starttag">locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0"</tag>
<tag class="starttag">documentElement localName="section" typeId="DocBook"</tag>
<tag class="starttag">documentElement localName="chapter" typeId="DocBook"</tag>
<tag class="starttag">documentElement localName="article" typeId="DocBook"</tag>
<tag class="starttag">documentElement localName="book" typeId="DocBook"</tag>
<tag class="starttag">typeId id="DocBook" uri="/usr/local/share/xml/docbook/5.0/rng/docbook.rnc"</tag>
<tag class="endtag">locatingRules</tag></programlisting>
</sect2>
<sect2 xml:id="editor-config-emacs-igor">
<title>Automated Proofreading with Flycheck and Igor</title>
<para>The Flycheck package is available from Milkypostman's
Emacs Lisp Package Archive (<acronym>MELPA</acronym>). If
<acronym>MELPA</acronym> is not already in Emacs's
packages-archives, it can be added by evaluating</para>
<programlisting>(add-to-list 'package-archives '("melpa" . "http://stable.melpa.org/packages/") t)</programlisting>
<para>Add the line to Emacs's initialization file (one of
<filename>~/.emacs</filename>,
<filename>~/.emacs.el</filename>, or
<filename>~.emacs.d/init.el</filename>) to make this change
permanent.</para>
<para>To install Flycheck, evaluate</para>
<programlisting>(package-install 'flycheck)</programlisting>
<para>Create a Flycheck checker for
<package>textproc/igor</package> by evaluating</para>
<programlisting>(flycheck-define-checker igor
"FreeBSD Documentation Project sanity checker.
See URLs http://www.freebsd.org/docproj/ and
http://www.freshports.org/textproc/igor/."
:command ("igor" "-X" source-inplace)
:error-parser flycheck-parse-checkstyle
:modes (nxml-mode)
:standard-input t)
(add-to-list 'flycheck-checkers 'igor 'append)</programlisting>
<para>Again, add these lines to Emacs's initialization file to
make the changes permanent.</para>
</sect2>
<sect2 xml:id="editor-config-emacs-specifc">
<title>FreeBSD Documentation Specific Settings</title>
<para>To apply settings specific to the FreeBSD documentation
project, create <filename>.dir-locals.el</filename> in the
root directory of the documentation repository and add these
lines to the file:</para>
<programlisting>;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((nxml-mode
(eval . (turn-on-auto-fill))
(fill-column . 70)
(eval . (require 'flycheck))
(eval . (flycheck-mode 1))
(flycheck-checker . igor)
(eval . (add-to-list 'rng-schema-locating-files "~/.emacs.d/schema/schemas.xml"))))</programlisting>
</sect2>
</sect1>
<sect1 xml:id="editor-config-nano">