[Date Prev] [Date Index] [Date Next]
[Thread Prev] [Thread Index] [Thread Next]

[xyzzy:04894] speedbar



みなさん、こんにちは。

あほなもの、作りましたが、練習用なのでお許しを。

どーもよく分からない点が多いんです。


-------------------------------------------------------------------
;;; -*- Mode: Lisp; Package: EDITOR -*-
;;;
;;;  Is this file part of xyzzy?
;;;
;;;  lister2.l

;;; Code

(provide "lister2")

(in-package "editor")

(export '(lister-dialog-box))

(defvar *file-to-find* nil)

(defun lister-make-list (dir)
  (let (result)
    (dolist (x (directory dir :show-dots t :directory-only t))
      (setq result (cons (list x) result)))
    (dolist (x (directory dir :file-only t))
      (setq result (cons (list x) result)))
    (setq result (nreverse result))
    result))

(defvar *lister-dialog-template*
  '(dialog 0 0 100 420
    (:caption "speedbar")
    (:font 10 "MS Pゴシック")
    (:control
     (:listbox list nil #x50a10011 4 5 94 414)
     (:button go "移動(&G)" #x50030001 0 0 0 0))))


(defun lister-dialog-box ()
  (interactive)
  (let ((strings (lister-make-list (default-directory))))
    (multiple-value-bind (result data)
	(dialog-box *lister-dialog-template*
		    (list (cons 'list strings))
		    nil
	)
      (cond ((eq result 'go)
	     (setq *file-to-find* (cadr (assoc 'list data)))
	     (lister2-find-file *file-to-find*))
	    (t nil)))))

(defun lister2-find-file (file)
  (interactive)
  (if (lister-directory-p file)
      (progn (set-default-directory file)
	(lister-make-list file)
	(lister-dialog-box))
    (find-file fle)))

(defun lister-directory-p (file)
  (string-matchp "/$" file))


(global-set-key #\C-F2 'lister-dialog-box)

Index Home