;;; -*- Mode: Lisp; Package: USER; Last modified: "2010/04/14 07:34:47" -*-
;;;
;;; This file is not part of xyzzy.
;;;
;;;   OutlineX --- 娙堈傾僂僩儔僀儞
;;;
;;;     by HIE Masahiro <madoinux@gmail.com>
#|

仭奣梫

  僶僢僼傽偐傜巜掕偟偨僷僞乕儞偵儅僢僠偡傞峴傪拪弌偟傑偡丅


仭僀儞僗僩乕儖

  1. outlinex.l 傪 site-lisp 偵僐僺乕偡傞丅

  2. 昁梫偵墳偠丆僶僀僩僐儞僷僀儖偡傞丅

       M-x byte-compile-file

  3. .xyzzy 偐 siteinit.l 偵埲壓偺婰弎傪捛壛偡傞丅

      (require "outlinex")

  4. xyzzy 傪嵞婲摦偟丆愝掕傪斀塮偝偣傞丅
     siteinit.l 偵婰弎偟偨応崌偼嵞僟儞僾傕偡傞丅


仭婲摦曽朄

    M-x olx           : 惓婯昞尰傪巜掕偟偰幚峴

    M-x olx-selection : 僙儗僋僔儑儞偺暥帤楍傪僉乕偲偟偰幚峴
                        惓婯昞尰OFF偱幚峴偟傑偡丅

    M-x olx-flex      : 惓婯昞尰婛掕抣傪巊偭偰幚峴
                        儘乕僇儖曄悢 olx-pattern 偵愝掕偝傟偨惓婯昞尰偱幚峴偟傑偡丅
                        儌乕僪枅偵婛掕抣傪愝掕偡傞側偳偟偰巊偄傑偡丅(愝掕椺嶲徠)

    M-x olx-reload    : 慜夞偺専嶕僷僞乕儞偱嵞搙幚峴
                        outlinex 僶僢僼傽偑懚嵼偟偰偄傞仌outlinex 僶僢僼傽偑傾僋僥傿僽
                        偱側偄応崌偵幚峴偡傞偲丆outlinex 僶僢僼傽傪峏怴偟傑偡丅

    M-x olx-dialog    : 僟僀傾儘僌偐傜僷僞乕儞傪巜掕偟偰幚峴
                        扨岅扨埵専嶕丆戝暥帤彫暥帤嬫暿丆暘妱曽朄傪巜掕偡傞応崌偼丆
                        偙偺僐儅儞僪偱丅


仭僉乕僶僀儞僪

  傾僂僩儔僀儞僶僢僼傽偵偍偗傞僉乕僶僀儞僪偼丆埲壓偺偲偍傝丅

    q   : 廔椆
    TAB : 僇乕僜儖埵抲偺僲乕僪傪墈棗
    SPC : 僇乕僜儖埵抲偺僲乕僪偵堏摦
    RET : 僇乕僜儖埵抲偺僲乕僪偵堏摦偟廔椆

    M-Up       : 摨帪忋岦僗僋儘乕儖
    M-Down     : 摨帪壓岦僗僋儘乕儖

    d : 嶍彍儅乕僋傪偮偗傞乮僜乕僗僶僢僼傽偼曇廤偟傑偣傫乯
    m : 儅乕僋傪偮偗傞乮拝怓偡傞偩偗乯
    p : 尰嵼峴傪億僢僾傾僢僾昞帵
    t : 億僢僾傾僢僾昞帵傪僩僌儖
    u : 儅乕僋傪奜偡
    U : 慡偰偺儅乕僋傪奜偡
    x : 儅乕僋傪幚峴
    e : 峴斣崋傪嶍彍


仭愝掕椺

  仜F3 宯愯桳愝掕椺

    ;;; 僙儗僋僔儑儞偺暥帤楍傪僉乕偲偟偰幚峴 (旕惓婯昞尰)
    (global-set-key #\F3 'olx-selection)
    (set-function-bar-label #\F3 "olx-select")

    ;;; 惓婯昞尰傪巜掕偟偰幚峴
    (global-set-key #\S-F3 'olx)
    (set-function-bar-label #\S-F3 "olx")

    ;;; 儘乕僇儖側惓婯昞尰傪巊偭偰幚峴
    (global-set-key #\S-C-F3 'olx-flex)
    (set-function-bar-label #\S-C-F3 "olx-flex")

    ;;; 慜夞偺専嶕僷僞乕儞偱嵞搙幚峴 (or olx-rerun)
    (global-set-key #\M-F3 'olx-reload)
    (set-function-bar-label #\M-F3 "olx-reload")

    ;;; 僟僀傾儘僌偐傜僷僞乕儞傪巜掕偟偰幚峴
    (global-set-key #\C-F3 'olx-dialog)
    (set-function-bar-label #\C-F3 "olx-dialog")

  仜婛掕抣偺曄峏

    ;;; 専嶕僷僞乕儞偺婛掕抣
    (setq-default olx-pattern "[仭仩仠仜仢仧仦]")

    ;;; 廲偵暘妱偡傞
    (setq-default olx-vert-p t)

    ;;; 峴斣崋偺昞帵怓
    (setq *olx-color-line-number* '(:color 6 9))

  仜儌乕僪枅偺専嶕僷僞乕儞傪愝掕椺

    ;;; lisp-mode
    (add-hook '*lisp-mode-hook*
              #'(lambda ()
                  (setq olx-pattern "^\\(;;;\\|(def\\)")
                  (setq olx-vert-p t)))

    ;;; html-mode
    (add-hook 'ed::*html-mode-hook*
              #'(lambda ()
                  (setq olx-pattern "\\(<title\\|<h[0-4]\\)\\(>\\| +.*?>\\)")
                  (setq olx-coloring nil)))

  仜<strike>搷岲偒側曽</strike>psearch垽岲幰岦偗

    ;;; psearch 偺傛偆側怓晅偗傪偡傞
    (setq *olx-coloring-like-psearch* t)

    ;;; psearch 偺傛偆側怓晅偗傪偟偨応崌偺怓愝掕
    (setq *olx-attribute-like-psearch* '(:foreground 1 :background 2))

    ;;; psearch 偺傛偆側怓晅偗傪嶍彍
    (global-set-key '(#\C-c #\F3) 'olx-delete-attributes)

    ;;; 伀埲壓偼丆psearch 傪儘乕僪偟偨屻偵愝掕偡傞偙偲丅伀

    ;;; psearch 幚峴帪偵 olx 偺怓傪徚偡
    (add-hook '*psearch-hook* 'olx-delete-attributes)

    ;;; olx 幚峴帪偵 psearch 偺怓傪徚偡
    (defun olx-delete-psearch-attributes ()
      "outlinex: psearch 偺怓晅偗傪嶍彍"
      (when (fboundp 'psearch-delete-attributes)
        (psearch-delete-attributes)))
    (add-hook '*olx-pre-hook* 'olx-delete-psearch-attributes)

    ;;; 怓傪徚偟偨偄帪偼 psearch 偺怓晅偗傕摨帪偵嶍彍
    (defun olx-delete-attributes-with-psearch ()
      "outlinex: olx 偲 psearch 偺怓晅偗傪摨帪偵嶍彍"
      (interactive)
      (olx-delete-attributes)
      (olx-delete-psearch-attributes))
    (global-set-key '(#\C-c #\]) 'olx-delete-attributes-with-psearch)

    ;;; olx-selection 偱億僀儞僩偺暥帤楍傪庢摼
    (setq *olx-use-psearch-get-string* t)

  偲偐丅


仭峏怴棜楌

  [Version 3.06] 2010-04-14 (悈)
  丒olx-reload 偺嵺偵丆応崌偵傛傝僜乕僗僶僢僼傽偺僨乕僞傪夡偟偰偟傑偆
    晄嬶崌傪廋惓偟偨丅(T-T)
  丒拪弌懳徾偑側偐偭偨応崌偵丆傾僂僩儔僀儞僶僢僼傽傪嶍彍偟側偄傛偆偵偟偨丅
    (儕儘乕僪帪偵拪弌懳徾偑側偄偲寠偑偁偔偨傔)
  丒僲乕僪偵堏摦帪丆昁偢僜乕僗僶僢僼傽偵堏摦偡傞傛偆偵丅
  丒olx-rerun 傪捛壛偟偨丅愄偺 olx-reload 偲摨偠丅尰嵼偺 olx-reload 偲偺
    堘偄偼丆婛偵傾僂僩儔僀儞僶僢僼傽偑懚嵼偡傞応崌偵丆偳偪傜偑傾僋僥傿僽
    偵側傞偐偩偗丅
  丒偦偺懠嵶偐側廋惓丅

  [Version 3.05.1] 2010-04-02 (嬥)
  丒psearch.l 傛傝愭偵儘乕僪偡傞偲丆psearch-delete-attributes 偺 export 偵
    幐攕偡傞晄嬶崌傪廋惓偟偨(偼偢)丅 
    olx-delete-psearch-attributes, olx-delete-attributes-with-psearch 偼丆
    昁梫偵墳偠弶婜愝掕僼傽僀儖偱愝掕偡傞傛偆偵丅

  [Version 3.05] 2010-04-01 (栘)
  丒僸僢僩偟偨暥帤楍偑 point 傛傝慜偵偟偐側偄応崌偵儕僗僩偑嶌惉偝傟
    側偄晄嬶崌傪廋惓偟偨丅
  丒惓婯昞尰傪巊傢側偄応崌丆regexp t 偺傑傑巜掕暥帤楍傪 regexp-quote 
    偟偰幚峴偟偰偄偨偑丆regexp nil 偱幚峴偡傞傛偆偵偟偨丅
  丒暋悢偺僼儗乕儉偱幚峴偡傞偲昞帵偑曵傟偰偟傑偆偺偱丆僜乕僗僶僢僼傽枅偵
    傾僂僩儔僀儞僶僢僼傽傪帩偮傛偆偵偟偨丅
  丒dialogs.l 偐傜 search-dialog 偲 *search-dialog-template* 傪攓庁丅
      - 僟僀傾儘僌偐傜専嶕僆僾僔儑儞傪巜掕偱偒傞傛偆偵偟偨丅
      - 専嶕僆僾僔儑儞偼丆偡傋偰僶僢僼傽儘乕僇儖側抣偲偟偰曐帩偡傞傛偆偵偟偨丅
  丒psearch 偵夵傔偰姶壔偝傟偨丅
      - 億僀儞僩偺暥帤楍傪庢摼偱偒傞傛偆偵偟偨丅(梫 psearch)
      - 怓晅偗偱偒傞傛偆偵偟偨丅
          *olx-coloring-like-psearch*, *olx-attribute-like-psearch* 捛壛丅
      - 怓晅偗嶍彍傪峫椂偟偨丅
          *olx-pre-hook*, olx-delete-attributes, olx-delete-psearch-attributes, 
          olx-delete-attributes-with-psearch 捛壛丅
  丒儌乕僪峴偵丆専嶕僆僾僔儑儞傪昞帵偡傞傛偆偵偟偨丅
      [SWRE]劅劍劅 S or C : 戝暥帤彫暥帤傪嬫暿
              劌劅 W      : 扨岅扨埵偱専嶕
              劌劅 R      : 惓婯昞尰
              劋劅 E      : 僄僗働乕僾僔乕働儞僗傪棟夝
  丒olx-reload 偺嫇摦傪懡彮曄峏偟偨丅(傾僂僩儔僀儞偺峏怴傪偦傟傜偟偔)
  丒廲暘妱傪暅妶(--)丅偮偄偱偵丆億僢僾傾僢僾昞帵偡傞傛偆偵偟偨丅
      olx-vert-p 捛壛丅
  丒専嶕暥帤楍傪 *minibuffer-search-string-history* 偵捛壛偡傞傛偆偵偟偨丅
  丒忋壓僲乕僪擖懼(olx-transpose-node-up 偲 olx-transpose-node-down)傪攑巭偟偨丅
    偙傟偱丆僜乕僗僶僢僼傽傪曇廤偡傞偙偲偼側偔側偭偨丅
  丒olx-left-press(僟僽儖僋儕僢僋偱奐偔) 偼丆僨僼僅儖僩偱偼僉乕妱傝摉偰傪偟側偄
    傛偆偵偟偨丅(儅僂僗慖戰偑偱偒側偔側偭偰偟傑偆偺偱)
  丒偦偺懠嵶偐側廋惓懡悢丅

  [Version 3.04] 2007-12-31 (寧)
  丒MIT儔僀僙儞僗偵偟偨丅

  [Version 3.03] 偄偮丠
  丒専嶕僷僞乕儞偺愝掕曽朄傪曄峏偟偨丅愝掕曽朄偼丆愝掕椺傪嶲峫偵丅専嶕僷
    僞乕儞偲拝怓桳柍偼丆埲壓偺儘乕僇儖曄悢偱愝掕偡傞傛偆偵丅
      olx-pattern
      olx-coloring
  丒埲壓偺曄悢傪嶍彍偟偨丅
      *olx-pattern-default*
      *olx-coloring*
      *olx-coloring-exception-mode*
      *olx-flex-mode-list*
  丒峴斣崋傪嶍彍偱偒傞傛偆偵偟偨丅(Jump 偼偱偒側偔側傝傑偡)
  丒娭悢 outlinex 傪 interactive 偱側偔偟偨丅
  丒娭悢 olx-toggle-coloring 傪嶍彍偟偨丅

  [Version 3.02] 2005-02-03 (Thu)
  丒grep 傪巊梡偡傞偲丆塀偟僶僢僼傽偵懳偟偰幚峴偱偒側偄傛偆側偺偱丆傗偼
    傝帺慜偱傾僂僩儔僀儞傪嶌惉偡傞傛偆偵偟偨丅(-.-)
  丒olx-scroll-up-both-window, olx-scroll-down-both-window 傪暅妶丅(-.-)

  [Version 3.01] 2004-12-09 (Thu)
  丒儅乕僋仌嶍彍儅乕僋偺拝怓曽朄傪彮偟曄峏偟偨丅

  [Version 3.00] 2004-12-01 (Wed)
  丒僗僋儔僢僠偐傜彂偒捈偟丆xyzzy 偺昗弨婡擻偱偁傞 grep 傪巊梡偟偰傾僂僩
    儔僀儞傪嶌惉偡傞傛偆偵偟偨丅
  丒儔僀僙儞僗傪 NYSL 偲偟偨丅
  丒儌乕僪枅偺専嶕僷僞乕儞傪曄悢偱巜掕偱偒傞傛偆偵偟偨丅
  丒忋壓偺僲乕僪傪擖傟懼偊傜傟傞傛偆偵偟偨丅
    乮帋嶌昳:僜乕僗僶僢僼傽傪曇廤偟傑偡丅乯
  丒儅乕僋傪晅偗偨傝丆峴嶍彍偲偐偱偒傞傛偆偵偟偨丅
    乮僜乕僗僶僢僼傽偼曇廤偟傑偣傫丅乯
  丒拝怓偟側偄儌乕僪傪偁傜偐偠傔巜掕偟偰偍偔傛偆偵偟偨丅
  丒峴斣崋偼忢偵昞帵偡傞傛偆偵偟偨丅
  丒嵍塃偵昞帵偱偒側偔偟偨丅
  丒廀梫偺側偝偦偆側専嶕僐儅儞僪傪嶍彍偟偨丅
  丒偦偺懠偄傠偄傠側婡擻嶍彍傪娷傓曄峏丅

  [Version 2.02] 2004/03/12 06:25:43 +0900
  丒峴斣崋傪 text-attribute 偵帩偮傛偆偵偟偨丅
  丒僉乕儚乕僪偺怓晅偗傪偡傞傛偆偵偟偨(揔摉)丅
  丒僲乕僪堏摦帪偵儅乕僋傪偮偗傞傛偆偵偟偨丅嫟捠愝掕偺乽儅乕僋峴偺峴斣崋傪斀揮乿
    偵僠僃僢僋傪擖傟偰偍偔偲丆堏摦偟偨応強偑傢偐傝傗偡偄偐傕丅
  丒峴斣崋傪昞帵偱偒傞傛偆偵偟偨丅乮扐偟丆峴斣崋傪昞帵偡傞偲丆儌乕僪偵傛偭偰偼
    僉乕儚乕僪偺怓晅偗偑偱偒側偔側傞傕偺偑偁傝傑偡偺偱偁偟偐傜偢乯丅
  丒昞帵埵抲傪愗傝懼偊傜傟傞傛偆偵偟偨丅
  丒olx-search 偱偼丆僉乕儚乕僪傪 regexp-quote 偡傞傛偆偵偟偨丅
  丒僿僢僟偲僼僢僞傪嶍彍偟偨丅
  丒偐傢傝偵僷僞乕儞傪昞帵偟偨傝丆僐僺乕偟偨傝偱偒傞傛偆偵偟偨丅
  丒*outlinex-mode-hook* 傪嶌惉偟偨丅
  丒*outlinex-default-size* 傪 *outlinex-default-height* 偲 *outlinex-default-width*
    偵暘偗偨丅
  丒*outlinex-colors* 傪 *outlinex-buffer-colors* 偵曄峏偟偨丅
  丒僉乕僶僀儞僪傪曄峏偟偨丅乮巹偑巊偭偰側偄傕偺傪嶍彍偟偰偟傑偭偨乯丅
  丒側傞傋偔梋寁側張棟傪偟側偄傛偆偵丅
  丒偦傟傜偟偄偲偙偵堏摦偡傞偺傪傕偆彮偟偦傟傜偟偔丅
  丒僒儞僾儖傪彮偟曄峏丅
  丒偦偺懠偄傠偄傠丅

  [Version 2.01] 2003/04/19 13:52:37 +0900
  丒user 僷僢働乕僕偵擖傟偨丅(__)
  丒娭悢柤 outlinex 傪 olx 偵曄峏偟偨丅
  丒psearch.l 傪傑偹偰丆olx-search 傪捛壛偟偨丅
  丒嶌惉偡傞懳徾偑側偄応崌偼丆傾僂僩儔僀儞僂傿儞僪僂傪嶌傜側偄傛偆偵偟偨丅
  丒僗僋儘乕儖儅乕僕儞偺婛掕抣傪 2 偵偟偨丅
  丒僒儞僾儖偺 my-outlinex 偵偪傚偭偲捛壛丅

  [Version 2.00] 2003/01/25 22:02:28 +0900
  丒outlinex 僷僢働乕僕偵擖傟偰傒偨丅
  丒儌乕僪枅偵張棟傪敾抐偡傞偁偨傝傪嶍彍偟丆乽愝掕椺乿偵壛偊偰傒偨丅
  丒僗僋儘乕儖儅乕僕儞傪愝掕偟偨丅
  丒怓晅偗傪曄峏偱偒傞傛偆偵偟偨丅
  丒僷僞乕儞偵儅僢僠偡傞暥帤楍偑柍偐偭偨応崌偵丆僄儔乕偑敪惗偡傞傛
    偆偵側偭偰偄偨偺傪廋惓偟偨丅
  丒専嶕帪偵丆儅僢僠偡傞暥帤楍偑柍偄偲丆僇乕僜儖偑堦恖曕偒偟偰偟傑
    偆偺傪廋惓偟偨丅
  丒outlinex-auto, *outlinex-make-and-move* 嶍彍丅
  丒偦偺懠偄傠偄傠丅

  (snip)

  [Version 1.00] 2002/08/18(擔)
  丒弶斉嶌惉丅(偍偦傜偔)


仭儔僀僙儞僗

  outlinex.l 偼MIT儔僀僙儞僗偵婎偯偄偰棙梡壜擻偱偡丅
  <http://www.opensource.org/licenses/mit-license.php>

Copyright (c) 2007-2010 HIE Masahiro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


仭幱帿

outlinex 傪嶌惉偡傞偵偁偨傝丆巊傢偣偰偄偨偩偄偨傝丆嶲峫偵偝偣偰偄偨偩偄
偨傝偟偨傕偺丅

丒婽堜偝傫偺 xyzzy (dialogs.l)
    http://www.jsdlab.co.jp/~kei/xyzzy/

丒傆偐偊偝傫偺 psearch
    http://www5e.biglobe.ne.jp/~fukafuka/xyzzy/script/

姶幱偱偡丅

|#

(provide "outlinex")

(defconstant *olx-version* "3.06")


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 曄悢愝掕 - 揔摉偵僇僗僞儅僀僘偡傞偁偨傝
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defvar-local olx-pattern
	      "^[ 丂\t]*\\(\\[\\|[亂仭仩仜仢仠]\\|[0-9A-Za-z]+[.)] \\|[0-9]+-[0-9]+\\. \\)"
	      "outlinex: 専嶕僷僞乕儞偺婛掕抣")

(defvar-local olx-coloring t
	      "outlinex: 拝怓偡傞")

(defvar-local olx-case-fold-search ':smart
	      "outlinex: 戝暥帤彫暥帤傪嬫暿偡傞")

(defvar-local olx-word-search nil
	      "outlinex: 扨岅扨埵偱専嶕偡傞")

(defvar-local olx-vert-p t
	      "outlinex: 廲偵暘妱偡傞")

(defvar-local olx-num-of-rows 35
	      "outlinex: 廲偵暘妱偟偨嵺偺昞帵楍悢
  - 乽15 乣 (xyzzy偺僂傿儞僪僂慡懱偺暆-15)乿偺娫偱巜掕")

(defvar *olx-color-buffer* nil
  "outlinex: 僶僢僼傽偺怓
  - BGR傪昞偡悢抣傪儀僋僞偱巜掕 (set-buffer-colors 偵搉偡)
  - #(0 #xe0ffff) 偲偐")

(defvar *olx-color-line-number* '(:color 15)
  "outlinex: 峴斣崋偺昞帵怓")

(defvar *olx-color-delete-line* '(:color 1 11)
  "outlinex: 嶍彍儅乕僋峴偺昞帵怓")

(defvar *olx-color-mark-line* '(:color 4 11)
  "outlinex: 儅乕僋峴偺昞帵怓")

(defvar *olx-color-point-line* '(:color 4 15)
  "outlinex: 億僀儞僩峴偺昞帵怓")

(defvar *olx-recenter-arg* 2
  "outlinex: 僲乕僪堏摦帪偺昞帵埵抲(峴悢)")

(defvar *olx-use-psearch-get-string* nil
  "outlinex: psearch偱億僀儞僩偺暥帤楍傪庢摼")

(defvar *olx-coloring-like-psearch* nil
  "outlinex: 僜乕僗僶僢僼傽偵psearch偺傛偆側怓晅偗傪偡傞")

(defvar *olx-attribute-like-psearch* '(:foreground 6 :background 15)
  "outlinex: 僜乕僗僶僢僼傽傊偺怓晅偗帪偺懏惈")

;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 曄悢愝掕 - 偁傑傝偝傢傜側偔偰椙偄傕偺
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defvar-local olx-buffer-name nil)

(defvar-local olx-last-search-pattern ""
	      "outlinex: 嵟屻偺専嶕僷僞乕儞")

(defvar-local olx-last-search-pattern-pair nil
	      "outlinex: 僄僗働乕僾僔乕働儞僗傪棟夝偡傞応崌偺嵟屻偺専嶕僷僞乕儞")

(defvar-local olx-last-search-regexp-p t
	      "outlinex: 嵟屻偺専嶕偑惓婯昞尰偐偳偆偐")

(defvar-local olx-understand-escape-sequences nil
	      "outlinex: 僄僗働乕僾僔乕働儞僗傪棟夝偡傞")

(defvar-local olx-move-and-popup nil
	      "outlinex: 忋壓堏摦帪偵億僢僾傾僢僾")

(defvar *olx-buffer-prefix* " *olx*-"
  "outlinex: 傾僂僩儔僀儞僶僢僼傽柤愙摢岅")

(defvar *olx-src-conf* nil
  "outlinex: 幚峴帪偺僂傿儞僪僂偺悢仌僶僢僼傽")

(defvar *olx-mark-char-list*
  '((#\M #\P #\+)   (#\D #\P #\-)
    (#\+ #\: #\P)   (#\- #\: #\P)   (#\P #\: #\SPC)
    (#\P #\c #\:)   (#\+ #\c #\M)   (#\- #\c #\D)
    (#\: #\c #\SPC) (#\M #\c #\SPC) (#\D #\c #\SPC)
    )
  "outlinex: 儅乕僋暥帤偺慻崌偣
  - ex. (#\M #\P #\+)
    尰嵼峴偑 M 偺応崌偵 P 偑巜掕偝傟傞偲 + 偵曄峏偡傞丅
  - #\SPC 偼曄峏偟側偄応崌丅")

(defvar *outlinex-mode-map* nil
  "outlinex: 傾僂僩儔僀儞僶僢僼傽梡僉乕儅僢僾")

(defvar *olx-pre-hook* nil
  "outlinex: 傾僂僩儔僀儞惗惉慜張棟")

(defvar *olx-hook* nil
  "outlinex: 傾僂僩儔僀儞惗惉屻張棟")


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 傾僂僩儔僀儞嶌惉
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defun olx (pattern)
  "outlinex: 惓婯昞尰傪巜掕偟偰傾僂僩儔僀儞傪嶌惉"
  (interactive "solx(regexp): " :default0 olx-pattern :history0 'ed::search)
  (olx-exec pattern t olx-coloring))

(defun olx-selection ()
  "outlinex: 僙儗僋僔儑儞偺暥帤楍偱傾僂僩儔僀儞傪嶌惉
  - 僙儗僋僔儑儞偑側偄応崌偼栤偄崌傢偣傑偡丅
  - psearch 傪巊偆偲丆億僀儞僩偺暥帤楍傪庢摼偟傑偡丅
  - 惓婯昞尰偼巊梡偟傑偣傫丅"
  (interactive)
  (let ((pattern (cond ((eq (get-selection-type) 2)
			(buffer-substring (selection-mark)
					  (selection-point)))
		       ((and *olx-use-psearch-get-string*
			     (fboundp 'ed::psearch-get-string))
			(ed::psearch-get-string))
		       (t (read-string "olx(non-regexp): " :history 'ed::search)))))
    (unless (string= pattern "")
      (olx-exec pattern nil olx-coloring))))

(defun olx-flex ()
  "outlinex: 儌乕僪枅偵搊榐偝傟偨惓婯昞尰偱傾僂僩儔僀儞傪嶌惉"
  (interactive)
  (olx-exec olx-pattern t olx-coloring))

(defun olx-reload (&optional active-olx-buffer)
  "outlinex: 慜夞偺専嶕僷僞乕儞偱嵞搙傾僂僩儔僀儞傪嶌惉
  - 婛偵傾僂僩儔僀儞偑懚嵼偟偰偄傞仌傾僂僩儔僀儞僶僢僼傽偑傾僋僥傿僽偱側偄
    (偲憐憸偝傟傞)応崌偼丆傾僂僩儔僀儞傪峏怴偡傞丅(庤敳偒)"
  (interactive)
  (unless olx-buffer-name
    (plain-error))
  (let* ((olx-buf (find-buffer olx-buffer-name))
	 (olx-buf-p (eq buffer-mode 'outlinex-mode))
	 (olx-p (and olx-buf
		     (not olx-buf-p)
		     (> (count-windows) 1)))
	 res)
    (when olx-buf-p
      (plain-error))
    (setq res (olx-exec olx-last-search-pattern olx-last-search-regexp-p olx-coloring))
    (when (and res olx-p)
      (recenter)
      (unless active-olx-buffer
	(olx-mark-point)
	(other-window -1)))))

(defun olx-rerun ()
  "outlinex: 慜夞偺専嶕僷僞乕儞偱嵞搙傾僂僩儔僀儞傪嶌惉
  - 儕儘乕僪幚峴屻丆傾僂僩儔僀儞僶僢僼傽傪傾僋僥傿僽偵偟偰偍偔丅"
  (interactive)
  (olx-reload t))

(defun olx-exec (pattern regexp &optional coloring)
  "outlinex: 傾僂僩儔僀儞傪嶌惉"
  (long-operation
    (run-hooks '*olx-pre-hook*)
    (when *olx-coloring-like-psearch*
      (delete-text-attributes 'olx))
    (let ((num-of-windows (count-windows))
	  (start-line (current-line-number))
	  (src-keyword-hash-table keyword-hash-table)
	  (src-syntax-table (syntax-table))
	  (src-regexp-keyword-list regexp-keyword-list)
	  (lines 0)
	  (match-p nil)
	  (olx-line nil)
	  (case-fold olx-case-fold-search)
	  (word-search olx-word-search)
	  (understand-escape olx-understand-escape-sequences)
	  (src-buffer (selected-buffer))
	  olx-buffer
	  )
      (setf olx-buffer-name (concat *olx-buffer-prefix* (buffer-name src-buffer)))
      ;; 幚峴帪偺忬懺傪婰壇 (count-window 偲 buffer)
      (unless (find-buffer olx-buffer-name)
	(setf *olx-src-conf* nil)
	(push num-of-windows *olx-src-conf*)
	(when (> num-of-windows 1)
	  (save-excursion
	    (other-window 1)
	    (setf *olx-src-conf*
		  (reverse (push src-buffer *olx-src-conf*)))
	    (other-window -1))))
      ;; 専嶕僷僞乕儞傪婰壇
      ;; 僟僀傾儘僌埲奜偺僐儅儞僪偱傕巊梡偡傞曄悢偼偙偙偱婰壇
      (add-history pattern '*minibuffer-search-string-history*)
      (setf olx-last-search-regexp-p regexp)
      (setf olx-last-search-pattern pattern)
      ;; olx 僶僢僼傽傪嶌惉
      (save-excursion
	(setf olx-buffer (switch-to-buffer olx-buffer-name))
	(setf buffer-read-only nil)
	(erase-buffer olx-buffer))
      ;; 専嶕幚峴
      (save-excursion
	(goto-char (point-min))
	(with-output-to-buffer (olx-buffer)
	  (while (scan-buffer (if regexp (compile-regexp pattern) pattern)
			      :regexp regexp
			      :no-dup nil
			      :case-fold   case-fold
			      :left-bound  word-search
			      :right-bound word-search
			      )
	    (setf match-p t)
	    (let ((match-line (current-line-number)))
	      (format t "~6,' D:~A~%"
		      match-line (buffer-substring (progn (goto-eol)(point))
						   (progn (goto-bol)(point))))
	      (setf lines (1+ lines))
	      (message "scanning ... ~D" (current-line-number))
	      (unless olx-line
		(setf olx-line (cond ((= match-line start-line) lines)
				     ((> match-line start-line) (1- lines))))))
	    (when *olx-coloring-like-psearch*
	      (apply #'set-text-attribute
		     (match-beginning 0)
		     (match-end 0)
		     'olx *olx-attribute-like-psearch*))
	    (or (next-line)
		(return)))))
      ;; 壗傕拪弌偱偒側偐偭偨応崌
      (unless match-p
	;(delete-buffer olx-buffer)
	(message (concat "\"" pattern "\" 偼尒偮偐傜側偄"))
	(return-from olx-exec nil))
      ;; 僂傿儞僪僂暘妱
      (if olx-vert-p
	  (pop-to-buffer olx-buffer olx-num-of-rows t)
	(pop-to-buffer olx-buffer t))
      (outlinex-mode pattern regexp coloring
		     src-keyword-hash-table
		     src-regexp-keyword-list
		     src-syntax-table
		     case-fold
		     word-search
		     understand-escape
		     )
      ;; 偦傟傜偟偄埵抲偵堏摦
      (goto-line (or olx-line (point-max)))
      (refresh-screen)
      (recenter)
      (message "~D lines completed." lines)
      (run-hooks '*olx-hook*)))
  t)


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 怓晅偗嶍彍
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defun olx-delete-attributes ()
  "outlinex: 怓傪徚偡"
  (interactive)
  (delete-text-attributes 'olx))


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 outlinex-mode
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(unless *outlinex-mode-map*
  (setf *outlinex-mode-map* (make-sparse-keymap))
  (define-key *outlinex-mode-map* #\TAB 'olx-view)
  (define-key *outlinex-mode-map* #\SPC 'olx-jump-and-mark)
  (define-key *outlinex-mode-map* #\RET 'olx-jump-and-quit)
  (define-key *outlinex-mode-map* #\M-Up 'olx-scroll-down-both-window)
  (define-key *outlinex-mode-map* #\M-Down 'olx-scroll-up-both-window)
  ;(define-key *outlinex-mode-map* #\LBtnUp 'olx-left-press)
  (define-key *outlinex-mode-map* #\d 'olx-mark-delete)
  (define-key *outlinex-mode-map* #\m 'olx-mark)
  (define-key *outlinex-mode-map* #\u 'olx-unmark)
  (define-key *outlinex-mode-map* #\U 'olx-unmark-all)
  (define-key *outlinex-mode-map* #\x 'olx-mark-execute)
  (define-key *outlinex-mode-map* #\e 'olx-erase-line-number)
  (define-key *outlinex-mode-map* #\p 'olx-popup-line)
  (define-key *outlinex-mode-map* #\t 'olx-toggle-move-and-popup)
  (define-key *outlinex-mode-map* #\Up 'olx-previous-line)
  (define-key *outlinex-mode-map* #\Down 'olx-next-line)
  (define-key *outlinex-mode-map* #\q 'olx-quit))

(defun outlinex-mode (pattern
		      regexp
		      coloring
		      src-keyword-hash-table
		      src-regexp-keyword-list
		      src-syntax-table
		      case-fold
		      word-search
		      understand-escape)
  "outlinex: 傾僂僩儔僀儞昞帵梡儌乕僪"
  (kill-all-local-variables)
  (setf buffer-mode 'outlinex-mode)
  (setf mode-name "OutlineX")
  (use-keymap *outlinex-mode-map*)
  (setf buffer-read-only t)
  (setf ed::*paren-status* nil)
  ;; 僜乕僗僶僢僼傽偺儌乕僪偱拝怓
  (when coloring
    (when src-keyword-hash-table
      (make-local-variable 'keyword-hash-table)
      (setf keyword-hash-table src-keyword-hash-table))
    (when src-syntax-table
      (use-syntax-table src-syntax-table)))
  (make-local-variable 'regexp-keyword-list)
  (let ((olx-regexp-keyword-list
	 (compile-regexp-keyword-list
	  `(("^ *[0-9]+:" t ,*olx-color-line-number*)
	    ("^\\( *[0-9]+D\\)\\(.*\\)" t ((1 . ,*olx-color-delete-line*)
					   (2 . ,*olx-color-delete-line*)))
	    ("^\\( *[0-9]+M\\)\\(.*\\)" t ((1 . ,*olx-color-mark-line*)
					   (2 . ,*olx-color-mark-line*)))
	    ("^\\( *[0-9]+[P+-]\\)\\(.*\\)" t ((1 . ,*olx-color-point-line*)
					       (2 . ,*olx-color-point-line*)))
	    ))))
    (setf regexp-keyword-list (if (and coloring src-regexp-keyword-list)
				  (append src-regexp-keyword-list olx-regexp-keyword-list)
				olx-regexp-keyword-list)))
  (make-local-variable 'mode-line-format)
  (setf mode-line-format
	(format nil "--%*- %M version ~A [%k:%l] %P [~A~A~A~A] pattern:\"~A\""
		*olx-version*
		(cond ((equal case-fold ':smart) "S")
		      ((not case-fold) "C")
		      (t "-"))
		(if word-search "W" "-")
		(if regexp "R" "-")
		(if understand-escape "E" "-")
		pattern))
  ;; 僶僢僼傽偺忬懺傪挷惍
  (let ((buf (selected-buffer)))
    (set-local-window-flags buf *window-flag-line-number* nil)
    (set-local-window-flags buf *window-flag-cursor-line* t)
    (set-buffer-fold-width nil buf)
    (set-buffer-modified-p nil buf)
    (set-buffer-colors *olx-color-buffer* buf)))

(defun olx-view ()
  "outlinex: 僲乕僪傪昞帵"
  (interactive)
  (olx-jump t))

(defun olx-jump (&optional view mark)
  "outlinex: 僲乕僪偵堏摦"
  (interactive)
  (unless (eq buffer-mode 'outlinex-mode)
    (return-from olx-jump nil))
  (when mark
    (olx-mark-point))
  (let* ((num (if (eobp)
		  -1
		(olx-line-number)))
	 (src-buffer-name (substitute-string
			   (buffer-name (selected-buffer))
			   (regexp-quote *olx-buffer-prefix*)
			   ""))
	 (src-buffer (find-buffer src-buffer-name)))
    (unless src-buffer
      (msgbox "~A 偑側偄傛傫" src-buffer-name)
      (return-from olx-jump nil))
    (when (and num (other-window -1))
      (set-buffer src-buffer)
      (if (= num -1)
	  (progn
	    (goto-char (point-max))
	    (goto-bol))
	(goto-line num))
      (set-mark)
      (recenter *olx-recenter-arg*)
      (when view
	(other-window)))))

(defun olx-jump-and-mark ()
  "outlinex: 僲乕僪偵堏摦偟儅乕僋"
  (interactive)
  (olx-jump nil t))

(defun olx-quit ()
  "outlinex: 廔椆"
  (interactive)
  (when (eq buffer-mode 'outlinex-mode)
    (close-selected-buffer)
    (let ((c (first  *olx-src-conf*))
	  (b (second *olx-src-conf*)))
      (if (and (> c 1)
	       (= c (count-windows)))
	  (progn
	    (set-buffer b)
	    (other-window -1))
	(if (> (count-windows) 1)
	    (delete-window))))))

(defun olx-jump-and-quit ()
  "outlinex: 僲乕僪偵堏摦偟廔椆"
  (interactive)
  (olx-view)
  (olx-quit))

(defun olx-left-press ()
  "outlinex: 僟僽儖僋儕僢僋偱奐偔"
  (interactive)
  (let ((click (mod *last-mouse-click-count* 6)))
    (if (= click 2)
	(olx-jump-and-quit)
      (mouse-left-press))))

(defun olx-scroll-up-both-window ()
  "outlinex: 忋岦摨帪僗僋儘乕儖"
  (interactive)
  (next-line)
  (olx-view))

(defun olx-scroll-down-both-window ()
  "outlinex: 壓岦摨帪僗僋儘乕儖"
  (interactive)
  (previous-line)
  (olx-view))

(defun olx-erase-line-number ()
  "outlinex: 峴斣崋傪嶍彍"
  (interactive)
  (when (and (eq buffer-mode 'outlinex-mode)
	     (yes-or-no-p "峴斣崋傪嶍彍偟傑偡偺丠"))
    (save-excursion
      (setf buffer-read-only nil)
      (kill-rectangle (progn
			(goto-char (point-min))
			(point))
		      (progn
			(goto-char (point-max))
			(previous-line)
			(scan-buffer ":" :tail t)
			(point)))
      (setf buffer-read-only t))))

(defun olx-toggle-move-and-popup ()
  "outlinex: 忋壓堏摦帪偵億僢僾傾僢僾傪僩僌儖"
  (interactive)
  (unless olx-move-and-popup
    (olx-popup-line))
  (setf olx-move-and-popup (not olx-move-and-popup)))

(defun olx-popup-line ()
  "outlinex: 尰嵼峴偺暥帤楍傪億僢僾傾僢僾昞帵"
  (interactive)
  (save-excursion
    (let ((p (point))
	  (s (buffer-substring
	      (progn (goto-bol) (forward-char 7) (point))
	      (progn (goto-eol) (point)))))
      (popup-string (string-left-trim " \t" s) p))))

(defun olx-next-line (&optional previous)
  "outlinex: 師峴偵堏摦仌峴偺暥帤楍傪億僢僾傾僢僾昞帵"
  (interactive)
  (if previous
      (previous-line)
    (next-line))
  (when olx-move-and-popup
    (olx-popup-line)))

(defun olx-previous-line ()
  "outlinex: 慜峴偵堏摦仌峴偺暥帤楍傪億僢僾傾僢僾昞帵"
  (interactive)
  (olx-next-line t))


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 傑乕偔
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defun olx-mark (&optional (c #\M) no-move)
  "outlinex: 儅乕僋傪偮偗傞
  - 1峴偱昞尰偟偰偄傞偨傔愗懼偑柺搢側丅
  - M: 儅乕僋
  - D: 嶍彍儅乕僋
  - P: olx-jump偟偨峴
  - +: M + P
  - -: D + P"
  (interactive)
  (when (or (not (eq buffer-mode 'outlinex-mode))
	    (get-buffer-file-name))
    (plain-error))
  (goto-column 1)
  (when (eobp)
    ;(plain-error "偁傝傑偣傫")
    (return-from olx-mark nil))
  (scan-buffer "[:DMP+-]" :regexp t)
  (let ((buffer-read-only nil)
	(a (char-after (point)))
	cc)
    (declare (special buffer-read-only))
    (setf cc (dolist (x *olx-mark-char-list*)
	       (when (and (char= (first x) a)
			  (char= (second x) c))
		 (return (third x)))))
    (cond (;儅乕僋偺曄峏傪偟側偄
	   (and cc (char= cc #\SPC))
	   (insert cc)
	   (backward-char))
	  (;曄姺屻偺儅乕僋偵曄峏
	   cc (insert cc))
	  (;巜掕偝傟偨儅乕僋偵曄峏
	   t  (insert c)))
    (delete-char 1)
    (set-buffer-modified-p nil))
  (unless no-move
    (forward-line 1)))

(defun olx-mark-point ()
  "outlinex: 億僀儞僩峴(僕儍儞僾偡傞峴)偵儅乕僋傪偮偗傞"
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (not (eobp))
      (olx-mark #\c)))
  (olx-mark #\P t))

(defun olx-mark-delete ()
  "outlinex: 嶍彍偡傞峴偵儅乕僋傪偮偗傞"
  (interactive)
  (olx-mark #\D))

(defun olx-unmark ()
  "outlinex: 儅乕僋傪奜偡"
  (interactive)
  (olx-mark #\:))

(defun olx-unmark-all ()
  "outlinex: 偤傫傇偺儅乕僋傪奜偡"
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (not (eobp))
      (olx-unmark))))

(defun olx-mark-execute ()
  "outlinex: 儅乕僋傪幚峴
  - 嶍彍儅乕僋偺晅偄偨傾僂僩儔僀儞峴傪嶍彍偡傞丅
    仸尦僶僢僼傽偼嶍彍偝傟傑偣傫丅"
  (interactive)
  (goto-char (point-min))
  (let ((buffer-read-only nil))
    (declare (special buffer-read-only))
    (while (scan-buffer "^ *[0-9]+D.*" :regexp t)
      (delete-region (point) (progn (next-line) (point))))
    (set-buffer-modified-p nil))
  (goto-char (point-min)))


;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 曗彆娭悢
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defun olx-line-number ()
  "outlinex: 僇乕僜儖埵抲偺僲乕僪偺峴斣崋傪庢摼"
  (save-excursion
    (goto-bol)
    (if (looking-at "^ *\\([0-9]+\\)[:DMP+-]")
	(parse-integer
	 (string-left-trim
	  " "
	  (buffer-substring (match-beginning 1) (match-end 1))))
      0)))

;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;
;;;  仭 僟僀傾儘僌
;;; 劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅劅 ;;;

(defvar *olx-dialog-template*
  '(dialog 0 0 242 114
    (:caption "OutlineX")
    (:font 9 "MS UI Gothic")
    (:control
     (:static nil "専嶕(&S):" #x50020000 7 10 28 8)
     (:combobox search nil #x50210842 39 8 140 96)
     (:button case-fold "戝暥帤彫暥帤傪嬫暿偡傞(&C)" #x50010006 39 27 96 10)
     (:button word "扨岅扨埵偱専嶕偡傞(&W)" #x50010003 39 40 83 10)
     (:button regexp "惓婯昞尰(&E)" #x50010003 39 53 52 10)
     (:button escseq "僄僗働乕僾僔乕働儞僗傪棟夝偟傠(&Y)" #x50010003 39 66 107 10)
     (:button vert-p "廲偵暘妱(&V)" #x50010003 39 79 107 10)
     (:static nil "楍悢(&L):" #x50020000 7 96 40 8)
     (:edit rows nil #x50810086 39 92 20 14)
     (:button IDOK "幚峴(&E)" #x50010001 185 7 50 14)
     (:button IDCANCEL "僉儍儞僙儖" #x50010000 185 24 50 14)
     )))

(defun olx-dialog ()
  "outlinex: 僟僀傾儘僌偐傜忦審傪巜掕偟偰傾僂僩儔僀儞傪嶌惉
  - 乽僟僀傾儘僌偱愝掕偝傟偨抣偼丆偡傋偰僶僢僼傽儘乕僇儖側抣偲偟偰曐帩偝傟傞丅"
  (interactive)
  (multiple-value-bind (result data)
      (let ((string (or (selection-start-end (start end)
			  (buffer-substring start end))
			(unless (string= olx-last-search-pattern "")
			  olx-last-search-pattern)
			olx-pattern)))
	(dialog-box *olx-dialog-template*
		    (list (cons 'search *minibuffer-search-string-history*)
			  (cons 'case-fold (ed::cfs2dialog olx-case-fold-search))
			  (cons 'word olx-word-search)
			  (cons 'regexp olx-last-search-regexp-p)
			  (cons 'vert-p olx-vert-p)
			  (cons 'rows (format nil "~A" olx-num-of-rows))
			  (cons 'search (if (eq (cdr olx-last-search-pattern-pair)
						string)
					    (car olx-last-search-pattern-pair)
					  string))
			  )
		    '((word :disable (regexp))
		      (search :non-null "専嶕暥帤楍傪擖椡偟偰" :enable (IDOK))
		      (vert-p :enable (rows))
		      )))
    (when result
      (let ((string (cdr (assoc 'search data))))
	(when string
	  ;; 僟僀傾儘僌偱偟偐巊梡偟側偄曄悢偼偙偙偱婰壇
	  (setf olx-case-fold-search (ed::dialog2cfs (cdr (assoc 'case-fold data))))
	  (setf olx-word-search (cdr (assoc 'word data)))
	  (setf olx-last-search-regexp-p (cdr (assoc 'regexp data)))
	  (setf olx-understand-escape-sequences (cdr (assoc 'escseq data)))
	  (if olx-understand-escape-sequences
	      (setf olx-last-search-pattern-pair
		    (cons string
			  (setf string (decode-escape-sequence
					string olx-last-search-regexp-p))))
	    (setq olx-last-search-pattern-pair nil))
	  (setf olx-vert-p (cdr (assoc 'vert-p data)))
	  (setf olx-num-of-rows (olx-dialog2nor (cdr (assoc 'rows data))))
	  (olx-exec string olx-last-search-regexp-p olx-coloring)
	  )))))

(defun olx-dialog2nor (x)
  "outlinex: 昞帵楍悢巜掕帪偺僄儔乕僠僃僢僋
  - 僄儔乕偲側傝偦偆側抣偑巜掕偝傟偨応崌偼丆尰嵼偺抣偺傑傑偲偡傞丅
  - 0 傪巜掕偡傞偲丆敿暘偵暘妱偝傟傞丅"
  (let ((rows (ignore-errors (parse-integer x))))
    (if (and rows
	     (or (zerop rows)
		 (and (> rows 14)
		      (< rows (- (screen-width) 15)))))
	rows
      olx-num-of-rows)))


;;; outlinex.l ends here.
