Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 2013 19:55:25 +0000 (UTC)
From:      Warren Block <wblock@FreeBSD.org>
To:        doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org
Subject:   svn commit: r42381 - in head/en_US.ISO8859-1/books/fdp-primer: . editor-config
Message-ID:  <201307221955.r6MJtQFI097536@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wblock
Date: Mon Jul 22 19:55:25 2013
New Revision: 42381
URL: http://svnweb.freebsd.org/changeset/doc/42381

Log:
  Add an editor configuration chapter that shows helpful configurations for
  specific editors.  Other editor configuration content will be moved to
  this chapter.

Added:
  head/en_US.ISO8859-1/books/fdp-primer/editor-config/
  head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml   (contents, props changed)
Modified:
  head/en_US.ISO8859-1/books/fdp-primer/Makefile
  head/en_US.ISO8859-1/books/fdp-primer/book.xml
  head/en_US.ISO8859-1/books/fdp-primer/chapters.ent

Modified: head/en_US.ISO8859-1/books/fdp-primer/Makefile
==============================================================================
--- head/en_US.ISO8859-1/books/fdp-primer/Makefile	Mon Jul 22 17:45:47 2013	(r42380)
+++ head/en_US.ISO8859-1/books/fdp-primer/Makefile	Mon Jul 22 19:55:25 2013	(r42381)
@@ -33,6 +33,7 @@ SRCS+= stylesheets/chapter.xml
 SRCS+= translations/chapter.xml
 SRCS+= writing-style/chapter.xml
 SRCS+= psgml-mode/chapter.xml
+SRCS+= editor-config/chapter.xml
 SRCS+= see-also/chapter.xml
 
 SRCS+= examples/appendix.xml

Modified: head/en_US.ISO8859-1/books/fdp-primer/book.xml
==============================================================================
--- head/en_US.ISO8859-1/books/fdp-primer/book.xml	Mon Jul 22 17:45:47 2013	(r42380)
+++ head/en_US.ISO8859-1/books/fdp-primer/book.xml	Mon Jul 22 19:55:25 2013	(r42381)
@@ -261,6 +261,7 @@ The time is 09:18</screen></entry>
   &chap.translations;
   &chap.writing-style;
   &chap.psgml-mode;
+  &chap.editor-config;
   &chap.see-also;
 
   &app.examples;

Modified: head/en_US.ISO8859-1/books/fdp-primer/chapters.ent
==============================================================================
--- head/en_US.ISO8859-1/books/fdp-primer/chapters.ent	Mon Jul 22 17:45:47 2013	(r42380)
+++ head/en_US.ISO8859-1/books/fdp-primer/chapters.ent	Mon Jul 22 19:55:25 2013	(r42381)
@@ -23,6 +23,7 @@
 <!ENTITY chap.translations	SYSTEM "translations/chapter.xml">
 <!ENTITY chap.writing-style	SYSTEM "writing-style/chapter.xml">
 <!ENTITY chap.psgml-mode	SYSTEM "psgml-mode/chapter.xml">
+<!ENTITY chap.editor-config	SYSTEM "editor-config/chapter.xml">
 <!ENTITY chap.see-also		SYSTEM "see-also/chapter.xml">
 
 <!ENTITY app.examples		SYSTEM "examples/appendix.xml">

Added: head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml	Mon Jul 22 19:55:25 2013	(r42381)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Copyright (c) 2013 Warren Block
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+    1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    2. Redistributions in binary form must reproduce the above
+    copyright notice, this list of conditions and the following
+    disclaimer in the documentation and/or other materials provided
+    with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS
+    IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+    FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+    AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+    $FreeBSD$
+-->
+
+<chapter id="editor-config">
+  <title>Editor Configuration</title>
+
+  <para>Adjusting text editor configuration can make working on
+    document files quicker and easier, and help documents conform to
+    <acronym>FDP</acronym> guidelines.</para>
+
+  <sect1 id="editor-config-vim">
+    <title><application>Vim</application></title>
+
+    <para>Install from <filename role="package">editors/vim</filename>
+      or <filename role="package">editors/vim-lite</filename>.</para>
+
+    <para>Edit <filename>~/.vimrc</filename>, adding these
+      lines:</para>
+
+    <programlisting>augroup sgmledit
+  autocmd FileType sgml set formatoptions=cq2l " Special formatting options
+  autocmd FileType sgml set textwidth=70       " Wrap lines at 70 columns
+  autocmd FileType sgml set shiftwidth=2       " Automatically indent
+  autocmd FileType sgml set softtabstop=2      " Tab key indents 2 spaces
+  autocmd FileType sgml set tabstop=8          " Replace 8 spaces with a tab
+  autocmd FileType sgml set autoindent         " Automatic indentation
+augroup END</programlisting>
+
+  </sect1>
+
+  <sect1 id="editor-config-emacs">
+    <title><application>Emacs</application></title>
+
+    <para>Install from
+      <filename role="package">editors/emacs</filename>
+      or <filename role="package">editors/xemacs</filename>.</para>
+
+    <para>Edit <filename>~/.emacs</filename>, adding these
+      lines:</para>
+
+    <programlisting>    (defun local-sgml-mode-hook
+      (setq fill-column 70
+	    indent-tabs-mode nil
+	    next-line-add-newlines nil
+	    standard-indent 4
+	    sgml-indent-data t)
+      (auto-fill-mode t)
+      (setq sgml-catalog-files '("/usr/local/share/xml/catalog")))
+    (add-hook 'psgml-mode-hook
+      '(lambda () (local-psgml-mode-hook)))</programlisting>
+  </sect1>
+
+  <sect1 id="editor-config-nano">
+    <title><application>nano</application></title>
+
+    <para>Install from
+      <filename role="package">editors/nano</filename> or
+      <filename role="package">editors/nano-devel</filename>.</para>
+
+    <para>Configuration:</para>
+
+    <screen>&prompt.user; <userinput>cp /usr/local/share/nano/xml.nanorc ~/.nanorc</userinput></screen>
+
+    <para>Use <command>printf</command> to add lines to the
+      configuration file.  Some have embedded <keycap>Tab</keycap>
+      characters, making this easier than editing the file
+      directly:</para>
+
+    <screen>&prompt.user; <userinput>printf '# trailing whitespace\n'                           >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf 'color ,blue "[[:space:]]+$"\n'                     >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf '# multiples of eight spaces at the start a line\n' >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf '# (after zero or more tabs) should be a tab\n'     >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf 'color ,blue "^([\t]*[ ]{8})+"\n'                   >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf '# tabs after spaces\n'                             >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf 'color ,yellow "( )+\t"\n'                          >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf '# lines longer than 70 characters\n'               >> ~/.nanorc</userinput>
+&prompt.user; <userinput>printf 'color ,red "^(([ ]{2})+|(\t+))*[ ]{1}[^ ]{1}"\n'   >> ~/.nanorc</userinput></screen>
+
+    <para>Specify additional helpful options when running the
+      editor.</para>
+
+    <screen>&prompt.user; <userinput>nano -AKipwz -r 70 -T8 <replaceable>chapter.xml</replaceable></userinput></screen>
+
+    <para>Users of &man.csh.1; can define an alias in
+      <filename>~/.cshrc</filename> to automate these options:</para>
+
+    <programlisting>alias nano "nano -AKipwz -r 70 -T8"</programlisting>
+
+    <para>After the alias is defined, the options will be added
+      automatically:</para>
+
+    <screen>&prompt.user; <userinput>nano <replaceable>chapter.xml</replaceable></userinput></screen>
+  </sect1>
+</chapter>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307221955.r6MJtQFI097536>