
                      LinuxDoc+Emacs+Ispell-HOWTO İ
                                       
ߣ Philippe MARTIN ( [1]feloy@wanadoo.fr)
Ӣߣ Sebastien Blondeel ( [2]Sebastien.Blondeel@lifl.fr)
ߣɺ An-Shan Lee ( [3]anshan@hello.com.tw)

   v0.4, 27 February 1998
     _________________________________________________________________
   
   ļҪṩ Linux HOWTOs ߼ Linux ļƻ
   (Linux Documentation Project) ߲οʹáӱĴҿҵһЩйʹ
   Emacs  Ispell ߵʾ 
     _________________________________________________________________
   
1. ǰ 

     * 1.1 Ȩ 
     * 1.2 л 
     * 1.3  
     * 1.4 汾 
       
2.  

     * 2.1 SGML
     * 2.2 LinuxDoc ̬ 
     * 2.3 SGML-Tools
       
3. ĵһļ 

     * 3.1 һݴֵļʼ 
       
4. 趨 Emacs

     * 4.1  (Accented Characters)
     * 4.2 SGML ģʽ (SGML mode)
     * 4.3 PSGML ģʽ (PSGML mode)
     * 4.4 ģʽ 
       
5. Ispell

     * 5.1 ѡԤǵ (default dictionaries)
     * 5.2 Ϊضļ趨Ĵǵ 
     * 5.3 ļƴּ 
     * 5.4 ˴ǵ𵵰ǵ (local file dictionary) ıȽ 
     * 5.5 ʱƴּ 
       
6. һЩͶļ 

     * 6.1 Զҳ (header)
       
Appendix

7. Insert-sgml-headerʽ֮
     _________________________________________________________________
   
1. ǰ

1.1 Ȩ

   Ȩ Philippe Martin 1998
   ֻҪصڶ֮汾 GNU ͨùȨ (General Public License)
   ɢ / ޸ļ
   
1.2 л

   رл Sebastien Blondeel Sebastien Ǹǳµˣͣ
   һй Emacs װ⡣:-) Ҳʵⶼ壬ʹ
   ܸе˽ Emacsѧ֪ʶṩҲο
   
1.3 

   κνԸƱģ벻ҪԥĸңһϸĲο
   
   춴ļֵ̽⣬κĻҲ뾡ĸңһ
   ĻشΪķʻҲܰҸƴļ
   
     ӢעΪļӢĺѶĻǾ͹ҷĲá
     עҶļʵĻǻǹӢޣΪ
     Ӣķġ:-P ЦģΪļķ
     ãṩңԱҸлл
     
1.4 汾

   ļа汾:
     * Sgml-tools 汾 0.99
     * Emacs 汾 19.34
     * Ispell 汾 3.1
     * ľص Emacs ʽⶼе Emacs 汾һУ
       iso-sgml  XEmacs һУ psgml ǶԷеĳʽ⡣
       
2. 

2.1 SGML

   Standard Generalised Mark-up LanguageΪ SGMLһֿԶļ
   ̬ԡ
   
   Ʃ磬Զʳ׵ļ̬һȳɷ֣ڶϣ
   һһָʾκ濾⣬֮һÿͼͿɱɿ
   ζˡ
   
   νļ̬ (Document Type Definition)ûж
   ƷӦʲӣֻ˵ļݴԼʲᡣ
   
   Դƣڶʳ׵̬ľ֮ᣬͻԼ
   Ƶʳףϲĳָģ԰ɣȻ
   ʵǲͬģҵҵĳɹƬǷԡҹӵϽ
   ɷֵıỨ԰Ӿ뿾֮䡣أ
   
   л SGML ı׼壬ǿ԰ṩĸʽɵдһļ
   õ߻ῴдЩʲᡣ
   
2.2 LinuxDoc ̬

   ܲµģ̬д Linux ļ
   
   ļͨ£ļĿʼǱ⣬ߵƣļİ汾
   ڡժҪ߾Ͳƪļ֪֮Ⲣ
   뿴ļ֮Ŀ¼ʾļṹһЩ֪ĳһ
   ضݵ˾Ϳֱǲȥ
   
   Ȼһϵе½ڣȡⲿ֣Բ벿ֳʽı
   ǿĳۻӣб (lists)Եļһݶȡ
   ϣȵȡ
   
   ҪдļֻҪȷϸ˵ļı⣬ߣڣ汾½
   ֣Լ˵ʱĳһб (list)Ԫʲȵȼɡ
   
2.3 SGML-Tools

   SGML-ToolsԽһļתҪĸʽҪļ
   ˵ĳʽ⣬ѡת PostScript ʽҪ͸
   ·ɽת HTML ʽ Windows ¶ȡ˷ļ
   ԰ת RTF ʽʹȡҲԽ֮ת
   иʽԱκʱʹá
   
   ɴ FTP վ [4]ftp://ftp.lip6.fr/pub/sgml-tools/ ȡ SGML-Tools
   
3. ĵһļ

3.1 һݴֵļʼ

   Ҫһֵļת SGML Աٽ֮תĸʽ£
   
    1. ͷʱ־ǩ
        <!doctype linuxdoc system>
         <article>
          <title> (Title) Ŵ</title>
          <author>
           ߣߵĵʼʺţȵȡ
          </author>
          <date>
           汾
          </date>

    2. ҪڿͷʱժҪļݣ뽫бǩ춴˶ͷβ
       <abstract>  </abstract>
    3. ֮ <toc> ǩ SGML-Tools ԻʾļĿ¼ (Table Of
       Contents)
    4. ÿһ (chapter) Ŀʼ־ǩȡÿһµĺ뼰
       ⣺
       <sect>һµı (The Title Of The Chapter)

       һµĽβϴ </sect> ǩ
       ע  һµԺ룬 SGML-Tools Իϡ
    5. ͬķ춽ķֽ (section)ɾÿһڵĺ룬
       Դ <sect1> ǩÿһڿͷı⣬ÿһڵĽβ
       </sect1>
    6. ÿһУҲʹ <sectn>  </sectn> ǩֲ֮ 4
       Σÿһʹͬıǩ n=2,3,  4ơ
    7. ֮ᣬÿһ (paragraph) Ŀʼ <p> ǩ
    8. ڶУҪǿĳЩ֣ʹ <it>  </it> (б)
       <bf>  </bf> () <tt>  </tt> () ǩ
    9. Ҫб (list)зʽ
        ӣһеб

         - һз
         - ڶ
         - 
         - С

       зʽб
        һеб
       <itemize>
       <item>һз
       <item>ڶ
       <item>
       <item>tС
       </itemize>

   10. ҪڶзŽĳʽһ֣ҪͻĳЩطз
       ʽ
        <verb>
        10 REM ร죡ʲ᣿
        20 REM ΪⶫͲˣ
        30 PRINT "һص...";
        40 PRINT "硣"
        50 INPUT "ĵ֪ģ ",M$
        60 IF M$="" THEN PRINT "ܴ":GOTO PARADISE
        70 ELSE PRINT "Ȼɵġ":GOTO RICHMOND
        </verb>

   11. ĿǰΪֹѧ SGML ʽѾ൱áټǿ
       ļԲο SGML-Tools ʹָ꾡Ľй
       LinuxDoc ļ̬Ӧá
       
4. 趨 Emacs

4.1  (Accented Characters)

   ҪԷĻŷдļʹ 8-bit  (8-bit
   characters)ſʾ֡òſ Emacs Щ
   ֡
   
  ʾ 8-bit 
  
   Ҫ Emacs ʾ 8-bit ֣뽫ָ .emacs 
       (standard-display-european 1)
       (load-library "iso-syntax")

   һ֧Ԯ 8-bit ն˻ʹ Emacsʹ iso-ascii 
   ʽ ((load-library "iso-ascii"))ָ Emacs Ƶʽʾ
   Щ֡
   
  8-bit ֵļ
  
   ļ֣Ǿû⣬ҪȻҲзʽ
   ȣ
   
  Iso-acc ʽ
  
   Emacs iso-acc ʽʹ 7-bit ļ̼ 8-bit ֡
   
   ֻҪָ .emacs 
      (load-library "iso-acc")

   Ȼʹ Emacs ʱҪ༭ĵ Meta-x
   iso-accents-mode
   
   Ҫ뷨 cafe  e ĻͿȼ ' Ȼټ e֮
   ȼǸֵ֮ټԵĸ۴дСд
   һЩʹõ
   
     ' : Acute
   
     ` : Grave
   
     ^ : Circumflex
   
     " : Dieresis
   
     ~ : Tilde, cedilla, ر (cf iso-acc.el).
   
     / : һĸϼߣȵȡ
   
   ֻҪЩ֮һԵĸǾڷ֮
   һհ׼磬Ҫ l'elephantͼ l ' հ ' e l ' e ... ɡ
   
    iso-acc.el ҵҪϡ
   
  Meta 
  
   ĳЩն˻ʹ Meta ( Alt)  8-bit ֡磬
   Լ Meta-i  e ֡
   
   Ǿ֪ Emacs  Meta ϣĳʽƺҲṩ
   뷽ʽ
   
   ǻǿзʽȣ
   
      (global-set-key "\ei" '(lambda () (interactive) (insert ?\351)))
                         _                                      ___

   ֻҪָ .emacs ڣͿ Meta-i  eҲ
   ¶ҪϣֻҪҪּ (key) ȡ iȷı
   (code) ȡ 351ͿԵõҪĸɲο
   ISO-8859-1 character set ȡҪı롣
   
   ע⣡ ĳЩ local modes ¶ּϡ
   
  8-bit SGML ֵʾ
  
   ʹ SGML ʱþ޼ (macros) ֡磬Ҫ e 
    &eacute;ͨҪȡ SGML Ӧ嶼Զȡ 8-bit ֣
   һ㶼ò־޼ЩȻ޷ȡ 8-bit ֣ʱ
   Ϳ޼ˡ
   
   һʱʹ Emacs ʱ iso-sgml ʽ֡
   Ҫļ浽ŵʱҲ 8-bit ת SGML ĸʽԷ
   ȡ
   
   ʽ⣬Ϳʹ Emacs ʱɵȡ 8-bit 
   ֣һ 8-bit ֵ壬ҲԶȡд 8-bit ļ
   
   ֻҪּ .emacs ڣͿʹʽ⣺
   
      (setq sgml-mode-hook
      '(lambda () "Defaults for SGML mode."
       (load-library "iso-sgml")))

4.2 SGML ģʽ (SGML mode)

    .sgml ļʱ Emacs ͨԶ sgml ģʽ ûеĻ
   Լ Meta-x sgml-mode  sgml ģʽָ߽
    .emacs 趨Զ룺
   
      (setq auto-mode-alist
      (append '(("\.sgml$"  . sgml-mode))
                auto-mode-alist))

    sgml ģʽ£ѡҪ 8-bit ֡磬ʹ Meta-x
   sgml-name-8bit-mode ѡĿϵ SGML/Toggle 8-bit insertion
   ѡֱ 8-bit ֵĸʽ SGML ĸʽ &...; 
   ʽ
   
   ڴģʽ£Ҳʹ Meta-x sgml-tags-invisibleѡĿϵ
   SGML/Toggle Tag Visibility ѡǷҪػʾ SGML ǩ
   
4.3 PSGML ģʽ (PSGML mode)

   PSGML ģʽʹ Emacs ±༭ SGML ļ档
   
   ļ [5]psgml-linuxdoc ΰװģʽν֮Ӧ
   LinuxDoc
   
4.4 ģʽ

  Auto-fill mode
  
   һģʽ£һ䣬ͨ Return Ա㻻һУ
   µĶͻ޷ʹ Return Ա㻻һʱ
   Ķұͨǲβġ
   
   һж֣ĳЩ༭£޷ұ߱
   ʲᡣ
   
   £auto-fill ģʽ԰볬Ԥֵĵ70
   ʱģʽ£ͻԶһС
   
   ִ auto-fill ģʽָɽһеĿȵΪ80У
   
       (setq sgml-mode-hook
             '(lambda () "Defaults for SGML mode."
                 (auto-fill-mode)
                 (setq fill-column 80)))

5. Ispell

   Ҫʹ Emacs ʱƴּ飬ʹ Ispell ׼ Emacs ģ
   ʽ
   
5.1 ѡԤǵ (default dictionaries)

   趨 Emacsʹ֮ڿʼĳһļʱԶѡĴǵ䣨
   ѡüԤǵ (main dictionary) Ҫǵ䣬 Ispell һ
   еĴǵ䡣ѡҪԡڶĸ˴ǵ (personal
   dictionary)趨Ҫ Ispell ҪǵҲַŵ
   
   Ҫ Ispell ķĴǵΪԤǵ䣬Ŀ¼ (home
   directory) µ .ispell-dico-perso Ϊ˴ǵ䣬 .emacs 
   ָ
   
       (setq sgml-mode-hook
       '(lambda () "Defauts for SGML mode."
       (setq ispell-personal-dictionary "~/.ispell-dico-perso")
       (ispell-change-dictionary "francais")
       ))

5.2 Ϊضļ趨Ĵǵ

   ûͬһļƴ֣ܻһЩѡ
   ڷʱпܾʹòͬǵ䡣
   
   Զ趨ĻֶģҲ Lisp ѡǵ͸
   ˴ǵ䡣֪ĻŸң
   
   أÿһĽβֻҪָΪעָͣ
   еĵҪʹһǵ䡣 Ispell ʼƴּʱӦָĴǵ䣺
   
      <!-- Local IspellDict: english -->
      <!-- Local IspellPersDict: ~/emacs/.ispell-english -->

    .emacs Ѿ趨ԤǵΪģԽָ
   дӢļĽβԱʹӢĴǵ䡣
   
5.3 ļƴּ

   Ҫļļһʹ Meta-x ispell-buffer ָҲ
   ԼļĳЩֵƴ֣
   
     * ҪƴֵĲ֮ͷ Ctrl-Spc ע (mark) (ν
       mark-set-command)
     * ȻעǲֵĽβ
     * ټָ Meta-x ispell-region.
       
   Emacs ͻῪʼִ Ispellǵûеʱʽʾ֣
   ͨԷʾҪָ
   
     * spc accepts the word, this time only,
     * i accepts the word and inserts it in your personal dictionary,
     * a accepts the word for this session,
     * A accepts the word for this file, and inserts it in the local file
       dictionary
     * r allows you to correct the word by hand
     * R allows you to correct all the occurrences of the misspelled
       word,
     * x stops the checking, and puts the cursor back in place,
     * X stops the checking and leaves the cursor where it is, letting
       you correct your file; you will be able to continue the
       spell-checking later if you type Meta-x ispell-continue,
     * ? gives you online help.
       
    Ispell ҵƵĴʻ㣬ὫЩһСӴڣÿһ
   ǰкֻҪҪǸֻĺ룬 Ispell ͻѡ
   ȡ֡
   
5.4 ˴ǵ𵵰ǵ (local file dictionary) ıȽ

   i ĸ˴ǵڲһ֣ A ڸ𵵰ǵڲ
   ֡
   
   𵵰ǵʵһβһϵеֻۣ Ispell ÿμ
   ƴʱ¶ȡǵ䡣ˣͿԼһЩֻض
   ֣ܽܵɲܴ˴ǵӰ졣
   
   ҿΪ˴ǵһЩǵûе֣Щ
   춸Եַ֣ hyphenated ֣һЩͨõض
   ʣ Linuxڸ˴ǵڼ̫ĵҲ̫ãΪ
   Щ־ͻᱻһʹˣ Tof ˴ǵڣ
   Ispell ܾͻе֣
   
     `When the going gets tof, the tof get going.' Tof Ƿ Christophe
     ֵд
     
   
   
5.5 ʱƴּ

   ڼʱֻҪ ispell-minor-mode ģʽ£ Ispell ͻԶ
   ƴ֡Ҫرģʽָ Meta-x
   ispell-minor-modeÿ Ispell 鲻ʱͻһ
   
   һܷˣֻҪָ Meta-x set-variable RET
   visible-bell RET t RET ͿԸөĻ˸Ҳ
   .emacs ָص Emacs 
   
       (setq visible-bell t)

6. һЩͶļ

6.1 Զҳ (header)

    Emacs £Խκ¼ (hook) κεĶǴһ
   棬ִһµģʽȵȣ
   
   Ҳ autoinsert ʽִһЩرĶ Emacs ¿
   ʱʽͻݵı׼ҳס
   
   ǵΣ׼ҳ׾˵ļ̬ (LinuxDoc)⣬ߣ
   ڵĵط
   
   һβҳ׵ķԲһѶ
   ģ (template) Ҳһ elisp ʽ
   
  ɲһ
  
   һݵʱ Emacs ִԶ룬Ȼٶȡ
   autoinsert ʽҪı auto-insert-alist 
   ˲̬ͬҪҳסԤֵҪĵ
   ~/insert/ Ŀ¼£Ҫ¶ auto-insert-directory Ҳǿе
   
   
   ÿһһµ SGML ʱֻҪ .emacs ڼָʾ
   ͿԲ ~/emacs/sgml-insert.sgml 
   
      (add-hook 'find-file-hooks 'auto-insert)
      (load-library "autoinsert")
      (setq auto-insert-directory "~/emacs/")
      (setq auto-insert-alist
            (append '((sgml-mode .  "sgml-insert.sgml"))
                    auto-insert-alist))

   Ϳ ~/emacs/sgml-insert.sgml дԶҳףȻִ
    Emacs ĳһ foobar.sgml ֮ Emacs ѯȷԶ
   ָҪҳס
   
  ִһʽ
  
   ⷽͬС죬ͬ趨 auto-insert-alist 
   ҪһִгʽһֻҪ .emacs ڼָ
   ʾͿԶִУȻȰʽдһ
   ~/emacs/sgml-header.el ĵſԡ⺯ʽܻҪ
    .emacs 
   
      (add-hook 'find-file-hooks 'auto-insert)
      (load-library "autoinsert")
      (add-to-list 'load-path "~/emacs")
      (load-library "sgml-header")
      (setq auto-insert-alist
            (append '(((sgml-mode .  "SGML Mode") . insert-sgml-header))
                    auto-insert-alist))

   Բο [6]¼й Insert-sgml-header ʽӡ
   
Appendix

7. Insert-sgml-headerʽ֮

   ׫дһ Linux Documentation Project ļʱʹгʽ
   ԶԶҳס
   
   ͸һ mini-bufferʽҪṩһЩҪѶ
   
   ѯҪıʲᣬûṩҳ׾Ͳֱ⡣
   ڣߣߵĵʼʺ home page 룩
   
   ѯʷߵ֡ޣֱӼ ReturnУʽͻѯ
   ߵĵʼʺż home page ͬҲ룩
   
    current bufferκѶʽժҪ
   ͵һµıǩ֮Ὣα굼ҪժҪĵĵط
   
(defun insert-sgml-header ()
  "Inserts the header for a LinuxDoc document"
  (interactive)
  (let (title author email home translator email-translator home-translator dat
e
              starting-point)
    (setq title (read-from-minibuffer "Title: "))
    (if (> (length title) 0)
        (progn
          (setq date (read-from-minibuffer "Date: ")
                author (read-from-minibuffer "Author: ")
                email (read-from-minibuffer "Author e-mail: ")
                home (read-from-minibuffer "Author home page: http://")
                translator (read-from-minibuffer "Translator: "))
          (insert "<!doctype linuxdoc system>\n<article>\n<title>")
          (insert title)
          (insert "</title>\n<author>\nAuthor: ") (insert author) (insert "<new
line>\n")
          (if (> (length email) 0)
              (progn
                (insert "<htmlurl url=\"mailto:")
                (insert email) (insert "\" name=\"") (insert email)
                (insert "\"><newline>\n")))
          (if (> (length home) 0)
              (progn
                (insert "<htmlurl url=\"http://")
                (insert home) (insert "\" name=\"") (insert home)
                (insert "\">\n<newline>")))
          (if (> (length translator) 0)
              (progn
                (setq email-translator (read-from-minibuffer "Translator e-mail
: ")
                      home-translator (read-from-minibuffer "Translator home pa
ge: http://"))
                (insert "Translator : ")
                (insert translator)
                (insert "<newline>\n")
                (if (> (length email-translator) 0)
                    (progn
                      (insert "<htmlurl url=\"mailto:")
                      (insert email-translator) (insert "\" name=\"")
                      (insert email-translator)
                      (insert "\"><newline>\n")))
                (if (> (length home-translator) 0)
                    (progn
                      (insert "<htmlurl url=\"http://")
                      (insert home-translator) (insert "\" name=\"")
                      (insert home-translator)
                      (insert "\"><newline>\n")))))
          (insert "</author>\n<date>\n")
          (insert date)
          (insert "\n</date>\n\n<abstract>\n")
          (setq point-beginning (point))
          (insert "\n</abstract>\n<toc>\n\n<sect>\n<p>\n\n\n</sect>\n\n</articl
e>\n")
          (goto-char point-beginning)
          ))))

References

   1. mailto:feloy@wanadoo.fr
   2. mailto:Sebastien.Blondeel@lifl.fr
   3. mailto:anshan@hello.com.tw
   4. ftp://ftp.lip6.fr/pub/sgml-tools/
   5. http://www.linux-france.com/article/psgml-linuxdoc
   6. file://localhost/tmp/zh-sgmltools.25528/LinuxDoc+Emacs+Ispell-HOWTO.txt.html#insert-sgml-header
