<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sect1 PUBLIC "//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<sect1 xmlns:xi="http://www.w3.org/2001/XInclude">
  <title>Emacs による SGML 文書の編集<!-- SGML using Emacs --></title>
  <para>(もし Emacs を前に使ったことがないのなら...) Emacs という語句を見ただけでこの記事を読むのをやめてしまわせるかもしれませんし、
  それはよくわかります。私はなぜ地球上にこのように複雑で曖昧模糊としたものが存在し得るのか理解できませんでしたし、そういうわけで
  修得しようと努力することもありませんでした。私は単純で怠惰な男で、Nedit のような単純で強力なエディタが大好きだし、今でもなお
  偉大なエディタだと思っています。それでもなお、<emphasis>どうか信じて下さい</emphasis>、SGML 編集のために Emacs をみつけ、
  願わくばこの記事で学習すれば、本当に魅了されることでしょう。実際、魅了されるあまりすべての編集用途で Emacs を使うようになることさえ
  あるかもしれません。あなたは直接に、いつも Emacs を避けていたものの今やあなたの考えられる <emphasis>すべてのこと</emphasis>に
  Emacs を使っているある男からきいているのですから。
    <!-- (If you've never used Emacs before...) The word
    Emacs might scare away many people to reading this article, and
    I understand them. I could not understand why on earth an editor
    had to be so complicated and obscure, so I never put much effort
    in learning it. I am a simple and lazy man, and absolutely love
    simple and powerful editors like Nedit, and I still think it's
    a great editor. Nevertheless, <emphasis>and believe
    me</emphasis>, when you discover Emacs for SGML editing, as you
    will hopefully learn here, you will really be impressed. In
    fact, I can assure that you will be so impressed that you might
    even switch to Emacs for all your editing needs. You are hearing
    this first hand, from an all time Emacs avoider that is using
    Emacs now for <emphasis>everything</emphasis> you can think of. -->
  </para>
  <para>Emacs の学習は長い旅となりますが、<emphasis>それほど</emphasis>苦痛なものとはならないでしょう ;-)
  理解しなくてはならないのは Emacs はテキストエディタではなく完全な環境だということです。だから少しずつ慣れていけば
  結局は愛するようになるでしょう。
    <!-- Learning Emacs is a long journey but it doesn't have to be
    <emphasis>so</emphasis> painful [grin]. You have to understand
    that Emacs is not so much a text editor but a whole
    environment. So, if go little by little you will get used to it
    and actually get to love it. Eventually. -->
  </para>
  <para>とは言っても、例を試してみたいのならこの入門の実用的な部分に進む前に以下に述べるものをすべてインストールしなければなりません。
    <!-- That said, before we go into the practical part of this guide
    you will need to install all the following stuff if you want to
    run the examples. -->
  </para>
  <sect2>
    <title>システム要件<!-- System Prerequisites --></title>
    <para>あなたはシステムを調べて以下に述べるすべてのツールがインストール済みであり、使えることを確かめる必要があるでしょう。
      <!-- You will need to check your system and make sure you have all
      the tools described bellow installed and working. -->
    </para>
    <itemizedlist>
      <listitem>
	<para>何らかの Unix の香り漂う、あるいは Unix-like な OS。申し訳ありませんが、この記事は Windows ユーザ向けではありません。
	差別しているわけではなく、Windows でどうやって機能させるか手がかりもないし調べようとする興味もないからです。私の場合は
	Linux カーネルを用いた Debian システムを使っています。
	  <!-- Some flavor of UNIX or UNIX-Like OS. Sorry, this article
	  is not for Windoze users. I am not being discriminatory
	  but I have no clue as to how all these things work in this
	  environment and have no intention of finding out. I use
	  the Debian System with the Linux Kernel -->
	  <footnote>
	    <para>"この言い回しの微妙な正確さは Linux vs. GNU/Linux ジレンマの両方の側とも対立することを避けることを意図してのことです。"
	      <!-- The subtle precision of the sentence is intended to
	      purposely avoid confrontation with either side of the
	      Linux vs. GNU/Linux dilemma. -->
	    </para>
	  </footnote>.
	</para>
      </listitem>
      <listitem>
	<para>どれかのバージョンの <emphasis>GNU</emphasis> Emacs が必要でしょう。すべてがおそらく XEmacs でも機能するでしょうし、私は
	卒直にいうとこれら二つの間の違いについては知りません。とにかくあなたが XEmacs ユーザーならおそらくどうやったら機能するか知っているでしょう。
	私は 美しい X メニューとツールチップ付きの X のアクションバーとすべてを備えた Emacs 21 を使っています。
	この最新版は多分初心者には最適でしょう。
	  <!-- You will need some version of <emphasis>GNU</emphasis>
	  Emacs. All this probably works in XEmacs and I frankly do
	  not know the differences between the two. If you are an
	  XEmacs user you probably know how to get all this working
	  anyway. I use Emacs 21 which comes now with pretty X
	  menus, and an X action bar, with tool tips and all. This
	  latest version is probably best for beginners: -->
	</para>
	<screenshot>
	  <screeninfo>Emacs 21 の X でのグラフィカルなメニュー<!-- Graphical Menus in X --></screeninfo>
	  <graphic fileref="graphic/emacs-21-graphic-menu"></graphic>
	</screenshot>
      </listitem>
      <listitem>
	<para>PSGML: (PSGML の文書から引用) ``これは SGML と XML 文書の編集のためのメジャーモードです。
	GNU Emacs 19.34、20.3 以降および XEmacs 19.9 以降で動作します。PSGML は簡単な SGML パーザを含んでいて、
	任意の DTD と一緒に使うことができます。提供されるのはメニュー、文脈的に妥当なタグだけについてタグを
	挿入するコマンド、構造上のエラーについて識別する機能、種類と既定値の情報を別ウィンドウで表示しつつ
	属性値を編集する機能、そして構造に基づいた編集機能です。
	  <!-- PSGML: (Taken from the PSGML documentation) ``is a major
	  mode for editing SGML and XML documents. It works with GNU
	  Emacs 19.34, 20.3 and later or with XEmacs 19.9 and
	  later. PSGML contains a simple SGML parser and can work
	  with any DTD. Functions provided includes menus and
	  commands for inserting tags with only the contextually
	  valid tags, identification of structural errors, editing
	  of attribute values in a separate window with information
	  about types and defaults, and structure based editing.'' -->
	</para>
	<para>この文章では、このことと、なぜ Emacs が SGML や HTML のような構造化された文書の編集についてこれほど強力なのか
	ということに焦点をあてるつもりです。実際、HTML モードは非常に強力でウェブページの作成、編集が楽々できます。
	この記事を通して読むことであなたがこのメジャーモードを試してみようと励ますようなものとするつもりです。
	怠惰でビジュアルな形式の HTML エディタを好む人もいます。もちろんそれらのエディタは非常に使うのが簡単ですが、
	ウェブページをより動的なものと望んでいるなら非常に実用性に欠けています。それらが生成するコードは通常
	とても汚い(とりわけ MS-FrontPage が吐くコードは酷いものです)か不要なものでごちゃごちゃしていて Perl/CGI、PHP などで
	いうような動的なページをつくるためにあちこち断片を切り貼りするのを難しくしてしまいます。それに加えて、もしあなたが
	自分をプログラマだと考えていて、かつ HTML 編集にビジュアルなツールが必要であると認めているなら、おそらく
	あなたの職業は間違っていて、グラフィカルデザイナーに転業することを考えるべきでしょう。
	  <!-- This will be the main focus of this article, and why Emacs
	  can be so powerful for structured editing like SGML or
	  HTML. In fact, the HTML mode is very powerful and makes
	  creating and editing web pages a breeze. I would encourage
	  you very much to try this major mode, once you get through
	  this article. Some people are lazy and prefer a
	  Visual-Style HTML editor. Of course, these editors are
	  very easy to use but very impractical if you want your web
	  pages to be dynamic. The code they generate is usually
	  very dirty (in particular the MS-FrontPage code is
	  horrible) or cluttered with useless stuff, making it hard
	  to cut and paste pieces here and there to create dynamic
	  pages say in Perl/CGI or PHP. Besides, if you consider
	  yourself a programmer and admit to needing a Visual tool
	  for HTML you are probably in the wrong career and should
	  consider switching to graphical design. -->
	</para>
      </listitem>
      <listitem>
	<para>SGML Base および SGML data: Debian ではこれらはこのように呼ばれています。
	あなたのディストリビューションでも同等の環境を用意してやらなければならないでしょう。
	いずれにせよ、これは基本的な SGML カタログファイルと基本的な DTD (これについては後でより詳しく述べます)を
	インストールするはずです。強く推奨するのはシステム識別子
	  <!-- SGML Base and SGML data: This is how they are called in
	  Debian. You should have an equivalent setup in your
	  distribution. In any case this should install the base
	  SGML catalog file and basic DTDs (more on this later). I
	  am pretty sure that this is what let's your documents use
	  only public identifiers instead of system identifiers -->
	  <footnote>
	    <para>"すべての SGML 文書は最初の行に SGML 宣言あるいは次の形式の DOCTYPE 宣言を持たなければなりません:
	      <!-- The first line in all SGML documents has to be an SGML
	      declaration or a DOCTYPE declaration of the form: -->
<programlisting>&lt;!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [</programlisting>		
	    </para>
	    <para>この行はパーザ(文書を解釈するプログラム)にそれがどんな種類の文書で妥当性を検証するのにどの DTD を
	    使うべきなのかを指示します。上述の例では文書は DocBook DTD で定義された ``article'' です。セットアップが
	    適切になされていればそのファイルに対する物理的なパスを指定することなしにシステムは DTD をみつけることが
	    できるはずです。上手くいかないようならパーザが DTD をみつけられるように ``システム識別子を付加的に
	    追加する必要があるでしょう。システム識別子は次のような感じです:
	      <!-- This line will tell the parser (the program that
	      interprets the document) what type of document it is
	      and against which DTD it should validate. In the
	      example above, the document is an ``article'' defined
	      in the Docbook DTD. If everything is setup correctly,
	      the system should be able to find the DTD without
	      specifying a physical path to the file. If you can't
	      get this working, you will have to additionally add a
	      ``System Identifier'' so the parser can find the
	      DTD. Physical identifiers looks like: -->
<programlisting
>&lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook
  V4.1//EN" "/usr/lib/sgml/dtd/docbook-3.1/docbook.dtd"[</programlisting>
	    </para>
	    <para>私がインストールするように書いた SGML カタログファイルではきっと公開識別子
	    (文書をよりポータブルにします)だけを使うようになっているはずです。これについては
	    補足するコメントを誰か寄稿してくれるなどフィードバックを待っています。"
	      <!-- I am quite sure that the SGML catalog files that I
	      ask you to install is what let's you use only public
	      identifiers, making your documents way more
	      portable. If someone could contribute an additional
	      comment in this sense I would appreciate the feedback. -->
	    </para>
	  </footnote>
	  の代りに公開識別子を使うべきであるということで、そうすればあなたの SGML は完全にポータブルなものとなります。
	  <!-- , which makes your SGML documents completely portable. -->
	</para>
      </listitem>
      <listitem>
	<para>SGML Tools、SGML Tools Lite、DocBook Tools、Debian Doc、あるいは Linux Doc Tools。これはディストリビューションとあなたが
	何をしたいかに依ります。これらのパッケージはほとんどのディストリビューションで異なる名前で呼ばれていますが、同じことをします。
	インストールされるのは変換スクリプトで、SGML から御望みのもの (HTML、PS、PDF、RTF、TeX など)に変換するのを容易にします。
	これらのスクリプトはおそらく Jade や TeX のような他のパッケージへの何らかの依存関係を持っているでしょう。
	また DocBook DTD、DocBook DSSSL、XML と XSL (もしゆくゆくは DocBook XML を使いたいと望むなら)、DocBook ユーティリティも
	インストールする必要があります。いずれにせよ、これらユーティリティを一度インストールしてしまえば db2ps、db2html、db2rtf なども
	利用できるようになるでしょう。
	  <!-- SGML Tools, SGML Tools Lite, Docbook Tools, Debian Doc, or
	  Linux Doc Tools. It depends on your distribution and what
	  you want to do. These packages are called differently in
	  most distros but do the same thing. They install
	  converting scripts that facilitate the conversion from
	  SGML to whatever you want: HTML, PS, PDF, RTF, TeX,
	  etc. These scripts will probably cause some dependencies
	  on other packages, like Jade and TeX. You also have to
	  install the Docbook DTD, Docbook DSSSL, XML and XSL (if
	  you eventually want to work with XML-Docbook), and Docbook
	  Utilities. In any case, once you have these utilities
	  installed you will have the commands: db2ps, db2html,
	  db2rtf, and so on. -->
	</para>
	<para>これは Debian でのパッケージの情報から私が把握したいくつかの依存関係のリストです:
	  <!-- Here are some of the dependencies that I can figure out
	  from the package info in Debian: -->
	  <itemizedlist>
	    <listitem>
	      <para>テキストへの変換には groff-base が必要となります
		<!-- Conversion to text requires groff-base -->
	      </para>
	    </listitem>
	    <listitem>
	      <para>LaTeX への変換には tetex-base、tetex-bin、tetex-extra が必要となります
		<!-- LaTeX conversion requires tetex-base, tetex-bin, and
		tetex-extra. -->
	      </para>
	    </listitem>
	    <listitem>
	      <para>Info への変換には texinfo が必要です
		<!-- Info conversion requires texinfo. -->
	      </para>
	    </listitem>
	    <listitem>
	      <para>SGML Docbook の変換には一般に jade が必要となります
		<!-- Conversion of SGML Docbook in general requires Jade. -->
	      </para>
	    </listitem>
	    <listitem>
	      <para>Postcript への変換には TeX、DVI、GhostView と他の PS ツール、そしてもし生成された Postcript ファイルを閲覧したいなら
	      GhostView か同等なものが必要となります
		<!-- Conversion to Postcript requires TeX, DVI,
		GhostScript, and other PS tools, and if you want to
		view them, you will require GhostView or equivalent. -->
	      </para>
	    </listitem>
	  </itemizedlist>
	</para>
	<para>上のリストは代表的なものであり、各々のシステム、ディスリビューション、バージョンによって変わることでしょう。
	しかし SGML と Docbook は多くのフリーソフトウェア OS において十分な標準となっているので、おそらくあなたのシステムで
	必要なものすべてを簡単にインストールするマクロパッケージ(task install)か何かが用意されていることでしょう。
	  <!-- The above list is representative and it will vary
	  depending on each system, distribution and
	  version. Nevertheless, since SGML and Docbook are quite
	  standard in most Free Software OSs, it's likely that your
	  system has a macro package or (task install) that installs
	  everything you need with relative ease. -->
	</para>
      </listitem>
    </itemizedlist>
  </sect2>

  <sect2>
    <title>Hello World</title>
    <para>ここでコマンドプロンプトから <command>emacs</command> とするかデスクトップマネージャのメニューから選択して Emacs を起動します。
    X で起動しようとキャラクタシェルで起動しようと同じ Emacs であるということに注意して下さい。違いはキャラクタモードではマウスでの
    クリックの代わりにキーストロークでメニューを選択しなければならないというだけだと思います。実際私はピュアなコンソールモードで
    使ったことがないのでこれ以上はわかりません
    <footnote><para>素のコンソールでは日本語は表示できませんが、これは kon (Kanji ON Linux console) や
    <ulink url="http://www3.justnet.ne.jp/~nmasu/linux/jfbterm/">jfbterm</ulink> を利用すれば問題ありません。</para></footnote>
      <!-- At this point you should start emacs by invoking
      <command>emacs</command> at the command prompt or selecting
      the option from you desktop manager. Please note that emacs
      runs the same if you are in X Windows or in a character
      shell. I think that the only difference is that the menus in
      character mode have to be activated with keystrokes instead of
      clicking with the mouse. I really can't tell you much more as
      I have not used it in a pure console mode. -->
    </para>
    <para>Emacs を起動すると *scratch* バッファになっているはずです
      <!-- Once emacs is started you should be in the *scratch*
      buffer -->
      <footnote>
	<para>この記事は Emacs を使うための段階を追った入門であることに注意して下さい。このことについては沢山の情報があります。
	この記事では PSGML メジャーモードと Docbook DTD を使うことに焦点をあてますが、完全な初心者が実行するに十分な最小限の
	段階的なことだけを説明するつもりです。残りの部分については読者自身が調べて下さい。
	  <!-- Please note that this article is not a step-by-step guide
	  to using emacs. There is plenty of information on written
	  on this. This article will focus on using the PSGML major
	  mode and the Docbook DTD. I will however, go step-by-step
	  only the minimum necessary to get the absolute novice
	  going. The rest should be investigated by the reader. -->
	</para>
      </footnote>。コマンド <command>C-x C-f</command>で新規ファイルを作成できます。
      <!-- . You can create a new file by using the commands <command>C-x
      C-f</command>. -->
      <note>
	<para><command>C-x</command> は <keycap>Ctrl</keycap> キーを押した後で <keycap>x</keycap>を押すということに注意して下さい。
	コマンド <command>M-x</command> は <keycap>Alt</keycap> と <keycap>x</keycap> を同時に押します。Emacs では
	<keycap>Alt</keycap> キーはまず <keycap>Esc</keycap> を押して離してから対応するキーで続けるのと同じです。
	実際設定によっては <keycap>Alt</keycap> キーが使えず <keycap>Esc</keycap> の方法を強いられる場合があります。
	  <!-- Please note that <command>C-x</command> refers to pressing
	  the <keycap>Ctrl</keycap> key and then
	  <keycap>x</keycap>. The command <command>M-x</command>
	  refers to pressing the <keycap>Alt</keycap> key and the
	  <keycap>x</keycap>. The <keycap>Alt</keycap> key in Emacs
	  is the same as first pressing and releasing
	  <keycap>Esc</keycap> followed by the corresponding key. In
	  fact, in some setups the <keycap>Alt</keycap> key does not
	  work and you are obligated to use the <keycap>Esc</keycap>
	  approach. -->
	</para>
      </note>Emacs は画面下(ミニバッファと呼ばれます)でファイル名の入力を待ちます。そのディレクトリ(通常は ~/)に存在しないファイル名を
      入力すると、emacs は新規ファイルを作成します。ここではただ <filename>hello.sgml</filename> と入力し、enter を押して下さい。
      <!-- Emacs will prompt for the file name in the
      bottom of the screen, which is called the mini-buffer. If you
      type a non-existing filename in the current directory (usually
      ~/), emacs will create a new file. Just type
      <filename>hello.sgml</filename> and hit enter. -->
      <note>
	<para>Emacs 初心者はこのフレームの切替に少々混乱させられるかもしれませんが、Emacs はほとんどの切替を自動で行いますし、
	もし迷ってしまっても、ただミニバッファをクリックして <command>C-g</command> を数回押せば良いです。このコマンドは
	Emacs に前のコマンド群を中止するように指示します。
	  <!-- For the new-bee to emacs, this switching between the
	  frames might be a little confusing, nevertheless emacs
	  automates most of the switching, but if you ever get lost,
	  just click the mouse over the mini-buffer and type 
	  <command>C-g</command> a few times. This command tells emacs
	  to abort any previous commands. -->
	</para>
	<para>もし何らかの理由で画面を分割してしまったら、任意のフレームをクリックし、<command>C-x 1</command> とすれば
	(親しみやすい用語を使えば) ``最大化'' することができます。<command>C-x 2, 3 か何か数字</command> を試しに入力してみて下さい。
	[画面が分割されたら] ``最大化'' したいフレームを選んで <command>C-x 1</command> とします。マウスでどこでもクリックして
	フレーム選択できるので、初心者は X で Emacs を使う方が良いでしょう。
	  <!-- If you get your screen split for some reason, you can
	  ``maximize'' (to use a familiar term) any frame just by
	  clicking on it and typing <command>C-x 1</command>. You
	  can also split the screen in many different ways. Try it,
	  by using <command>C-x 2, 3, and so on</command>. When you
	  have finished just click on the frame you would like to
	  ``maximize'' and type <command>C-x 1</command>. Being in X
	  Windows is really a good idea for new-bees because you can
	  select frames by clicking anywhere on it with the mouse. -->
	</para>
      </note>PSGML が適切にインストールされていればミニバッファ内に <computeroutput>Loading psgml...done</computeroutput> と
      表示されるはずです。またステータスバー(ミニバッファのすぐ上の行)に SGML メジャーモードにいることを示す
      <computeroutput>(SGML)</computeroutput> という表示が出るはずです。
      <!-- If you installed PSGML correctly you should see 
      <computeroutput>Loading psgml...done</computeroutput> in the
      mini-buffer. Also, in the status bar (the line just on top of
      the mini-buffer) you should see (SGML) indicating that you have
      activated the SGML major mode. -->
      <note>
	<para>Emacs にはメジャーモードとマイナーモードがあります。メジャーモードは一度に一つだけアクティブになれます。
	私達が作業する SGML モードはメジャーモードです。マイナーモードは特定の作業を行うモードで、一つのメジャーモード内で
	複数のマイナーモードを実行できます。例えば、SGML モードで作業中にいろいろ手助けしてくれる auto-fill-mode や 
	ispell-mode といったとても便利なマイナーモードがあります。ispell マイナーモードは実時間で綴りを検査してくれますし、
	auto-fill マイナーモードは段落を巧みに調整してくれます。
	  <!-- Emacs works in major and minor modes. There can only be
	  one major mode activated at given time. The SGML mode is
	  the major mode we will be working with. Minor modes are
	  modes that do specific tasks and you can have many of them
	  running within a major mode. For example, there are very
	  useful minor modes like auto-fill-mode and ispell-mode,
	  which help you a lot when working with SGML. Ispell minor
	  mode will check your spelling in real time and auto-fill
	  mode will keep your paragraphs neatly justified. -->
	</para>
      </note>次は hello world 文書の完全なリストです:
      <!-- Here is the complete listing for the hello world document: -->
      <example id="hello-world-code">
	<title>Hello World Code Example</title>
<programlisting><xi:include href="hello-world.txt" parse="text" encoding="utf-8" /></programlisting>
      </example>この一連のキー操作は他の(LyX を除く)エディタの場合のようにして行うこともできますし、Emacs PSGML メジャーモードの
      構造化編集の能力の特長を活用して行うこともできます。さてここから刺激的な部分がはじまります...
      <!-- You could type this listing key by key just like in any other
      editor (except perhaps LyX), or you could take advantage of
      the structured editing capabilities of the Emacs PSGML major
      mode. Here is where the exciting part begins... -->
    </para>
    <sect3>
      <title>最初の一歩: 文書型宣言<!-- First Step: The Document Declaration --></title>
      <para>最初にまずやらなくてはならないのは文書型宣言を入力することで、これは手動でやります。
	The very first thing you must do is type the Document Type
	Declaration and this has to be done manually.
	<programlisting>
&lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []&gt;
	</programlisting>
	この文書の最初の行は Emacs に必要なときにパーズするための DTD をどこからみつけてくるかを指示します。DTD は DocBook の
	すべてのルールを含んでいて、PSGML が何をどこに置くか、そして字下げルールをみつけだせるようにします。
	<!-- This first line in the document will tell Emacs where to
	find the DTD so it can parse it whenever needed. The DTD
	contains all the rules for Docbook and will enable PSGML to
	figure out what goes where and the indentation rules! -->
      </para>
    </sect3>
    <sect3>
      <title>PSGML ではじめてみよう<!-- Start using PSGML --></title>
      <para>さてでは DOCTYPE 行にちょうど下図のようにカーソルを移動し、<command>C-c C-e</command> と入力して下さい。
      ミニバッファを見ると、Emacs がこの一での妥当な要素として <emphasis>book</emphasis>を選択していることがわかるでしょう。
      これはここでは他にここに置ける妥当な要素がないからです。それでは enter を押し、何が起きるか見てみるとしましょう。
      すべてが上手くいっていれば次のようなコードになるはずです:
	<!-- Now that you have your DOCTYPE line move the cursor just
	bellow and type the command <command>C-c C-e</command>. If
	you take a look at the mini-buffer you will see that Emacs
	has chosen <emphasis>book</emphasis> as the valid element
	here. This is because at this point in the document there is
	no other valid element you can place. Now hit enter and 
	see what happens. If all is working right you should have
	the following code: -->
	<programlisting>
&lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" []&gt;
&lt;book&gt;
&lt;/book&gt;
	</programlisting>
	再度 enter を押して <command>C-c C-e</command> とします。複数の選択肢があるために Emacs がどのタグを置くか決定できないでいるのを
	見ることができるでしょう。ちょうどシェルと同じように <keycap>タブ</keycap>を押して自動補完できますが、沢山選択肢があるので
	ここでの妥当なタグのリストを含む分割画面が表示されます:
	<!-- Now hit enter once again and <command>C-c C-e</command>. You
	will see that now Emacs cannot decide which tag to place
	here because there is more than one option. Just like a
	shell you can now hit <keycap>Tab</keycap> to auto-complete,
	but since there are many options what you get is a split
	screen with a list of valid tags at this point: -->
	<screenshot>
	  <screeninfo>自動補完と選択リスト<!-- Auto Completion and Selection --></screeninfo>
	  <graphic fileref="graphic/completion-list"></graphic>
	</screenshot>
      </para>
      <para>選択を中止するにはただ <command>C-g</command> とするか、タグの最初の数文字を入力(ここでは
      <emphasis>ti</emphasis>)し、<keycap>タブ</keycap>、<keycap>Enter</keycap>と入力します。するとタイトルがつくられ、Emacs が
      必要な個所にカーソルを合わせています! タイトルを入力し、行末に移動(多くのエディタのように <keycap>Enter</keycap> を押す)し、
      <keycap>Enter</keycap>、<command>C-c C-e</command>とします。さらに <emphasis>ch</emphasis>、<keycap>タブ</keycap>とします。
      さあ最初の章[chapter]ができました! <xref linkend="hello-world-code" />にリストされた hello-world.sgml コード全体が得られるまで
      続けて下さい。
	<!-- If you want to quit the selection just press
	<command>C-g</command> or type the first few letters of the
	tag (type <emphasis>ti</emphasis> now) and then
	<keycap>Tab</keycap> and <keycap>Enter</keycap>. Now you
	have created the title and Emacs sets the cursor exactly
	where you need it! Type in the title and move the cursor to
	the end of the line (like most editors press the
	<keycap>End</keycap> key) hit <keycap>Enter</keycap> and
	<command>C-c C-e</command>. Now type ch and
	<keycap>Tab</keycap>. You have just created your first
	chapter! Go on until you have the complete hello-world.sgml
	code listed in <xref linkend="hello-world-code" />. -->
      </para>
      <para>これで構造化テキストエディタというのが何を意味するのかわかりはじめたと思います。そしてこれは始まりにすぎません、
      というのは PSGML の機能は Emacs の多くの他の面白い特徴と結びつき、まさにそれが Emacs を仕事をこなすための最良の道具に
      仕立て上げているからです。もちろんここではまだ Emacs がとても風変りで動作が鈍いために好きになれないでいるでしょうから、
      いくつか拡張してみることにしましょう....
	<!-- At this point, you can start appreciating what is meant by a
	structured text editor. And this is just the beginning,
	because the PSGML functionality ties up with many other
	interesting features of Emacs that really makes it the best
	tool for the job. Of course, at this point you probably
	still don't like Emacs that much because it's still very
	weird and dull, so let's make some enhancements.... -->
      </para>
    </sect3>
    <sect3>
      <title>とっかかりは最高、でもやっぱり Emacs はまだ好きになれない<!-- Great intro, but I still don't like Emacs --></title>
      <para>私のようにとても親切で色鮮かなエディタから移ってきた多くのユーザにとっては Emacs はおそらく退屈で複雑でしょうから、
      この節では普通のエディタのように動作させるにはどうしたらよいか説明してみることにします。ほんのちょっとのカスタマイズで
      Emacs は少くともあなたの今使っているエディタよりも不親切ではなくなります。
	<!-- Well for many users like me that come from very friendly and
	colorful editors Emacs is probably dull and complicated,
	so in this section I will show you how to make it work like
	a normal editor. You will see that with just a little
	customization Emacs can become at least, if not friendlier,
	than your current editor. -->
      </para>
      <sect4>
	<title>フォントの色<!-- Font colors --></title>
	<para>私が Emacs を使いだしたときに欲しかった重要なものが構文強調表示であり、これを有効にするオプションをみつけることが
	まったくできませんでした。さあ、けれども心配はいりません、Emacs ではこれは <emphasis>Global Font Look</emphasis> と
	呼ばれています。今でもこれがなぜそのように呼ばれているのかは私にとっては謎ですが、とにかく次のようにして有効にすることができます:
	  <!-- The main thing I missed when I started using Emacs was
	  Syntax Highlighting, and I could never find the option to
	  turn it on. Well, no wonder... in Emacs it's called
	  <emphasis>Global Font Lock</emphasis>. Now why it is
	  called that way is still a mystery to me but here is how
	  you turn it on: -->
	</para>
	<para>
	  <command>M-x global-font-look</command>
	</para>
	<para>もちろん全部入力する必要はなく、ただ <emphasis>global-f</emphasis>、<keycap>タブ</keycap> と入力します。
	  <!-- Of course you don't have to type all this just type
	  <emphasis>global-f</emphasis> and hit
	  <keycap>Tab</keycap>. -->
	</para>
      </sect4>
      <sect4>
	<title>何が選択されているか見たい! <!-- I want to see what I'm selecting! --></title>
	<para>他の気に障る Emacs の標準の設定は選択個所を見ることができないということです。既定の設定では Emacs は無効にされたマークモードを
	持ち、次のようにして有効にできます:
	  <!-- Another annoying standard feature of Emacs is not being
	  able to see what you are selecting. By default, Emacs has
	  the mark mode switched off so you have to turn it on by: -->
	</para>
	<para>
	  <command>M-x transient-mark-mode</command>
	</para>
      </sect4>
      <sect4>
	<title>神様! この馬鹿な文字の回り込みをオフにできないの! <!-- My God! Can't you turn the stupid word wrap
	OFF! --></title>
	<para>これは私にとって間違いなく Emacs でもっともいらつくことでした。つまり、GNU コーディング標準が好むと好まざるによらず
	沢山の状況があり、それに合せて適切なマージンをとっていかなければならないということです。さて、ハッカー達はこの馬鹿げた機能を
	無効にするのを非常に難しくしていましたが、次のようにすれば無効できます:
	  <!-- This was by far the most annoying thing about Emacs for
	  me. I mean, there are many situations in which, whether the
	  GNU coding standards like it or not, you have to go beyond
	  the right margin. Well, they made it real hard for you to
	  turn this stupid thing off, but here is what you have to do: -->
	</para>
	<para>
	  <command>M-x hscroll-mode</command>
	</para>
	<para>次のはそれほど簡単ではありません。*scratch* バッファに移る(<emphasis>Buffers</emphasis> メニューから選択して
	*scratch* をクリックするだけです)必要があります。これは Lisp 評価バッファ(これは単にこのバッファのメジャーモードが
	標準で Lisp の評価に使われるということです。これはステータス行に表示されているのを見ることができます)です。そして
	次の行を入力します。
	  <!-- The next bit is not as trivial. You have to switch to the
	  *scratch* buffer (just select
	  the<emphasis>Buffers</emphasis> menu and click over
	  *scratch*. This is a Lisp evaluation buffer (it just means
	  that this buffer's major mode is Lisp Evaluation by
	  default; you can see this in the status line). Now type in
	  the following line: -->
	</para>
	<para>
	  <programlisting>
	    (setq-default truncate-lines 1)
	  </programlisting>
	  続けて <command>C-j</command> とします。これでこの Lisp コード行が実行されます。
	  <!-- Followed by <command>C-j</command>. This will execute this
	  line of Lisp code. -->
	</para>
      </sect4>
      <sect4>
	<title>カスタマイズを保存しよう<!-- Saving your customization --></title>
	<para>実際には、これを行う方法について私は知らないのでこの節のタイトルの目的とは違っています。カスタマイズを保存するには、
	<filename>.emacs</filename> というファイルをホームディレクトリにつくれば、Emacs が起動する度に毎回実行されるようになります。
	次はこうしてできた私の .emacs です:
	  <!-- Actually, the title of this subsections is misleading on
	  purpose, because I don't think there is way to do
	  this. What you have to do is create a file called
	  <filename>.emacs</filename> in your home directory so it
	  will get executed every time you start Emacs. Here is what
	  my .emacs file looks like up to now: -->
	</para>
	<para>
	  <programlisting>
	    (global-font-lock-mode)
	    (transient-mark-mode 1)
	    (hscroll-mode)
	    (setq-default truncate-lines 1)
	  </programlisting>
	</para>
      </sect4>
    </sect3>
  </sect2>
</sect1>

<!-- vim: sw=2 sts=2 ai si sm :
-->

