load in dirtree via el-get instead of custom added files to vendor directory

This commit is contained in:
2011-11-11 23:50:55 +00:00
parent 27fbaf5624
commit b85dbf862f
29 changed files with 11 additions and 3345 deletions

View File

@@ -88,7 +88,17 @@
:url "http://svn.ruby-lang.org/repos/ruby/trunk/misc/")
(:name yasnippet
:type git
:url "https://github.com/capitaomorte/yasnippet.git")))
:url "https://github.com/capitaomorte/yasnippet.git")
(:name tree-mode
:type emacswiki)
(:name windata
:type emacswiki)
(:name dirtree
:description "Directory tree views in Emacs"
:type git
:url "https://github.com/zkim/emacs-dirtree.git"
:depends (tree-mode windata)
:features dirtree)))
;;

View File

@@ -1,7 +1,2 @@
;; Load-path
(add-to-list 'load-path "~/.emacs.d/vendor")
;; Directory Sidebar
(require 'dirtree)
(autoload 'imenu-tree "imenu-tree" "Imenu tree" t)
(autoload 'tags-tree "tags-tree" "TAGS tree" t)

1795
vendor/dired-x.el vendored

File diff suppressed because it is too large Load Diff

180
vendor/dirtree.el vendored
View File

@@ -1,180 +0,0 @@
;;; dirtree.el --- Directory tree views
;; Copyright (C) 2010 Free Software Foundation, Inc.
;;
;; Author: Ye Wenbin <wenbinye@gmail.com>
;; Maintainer: Ye Wenbin <wenbinye@gmail.com>
;; Created: 09 Jan 2010
;; Version: 0.01
;; Keywords
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; There are several dir-tree widget implements, but I need these features:
;; 1. display many directory in one buffer to reduce buffer numbers
;; 2. reuse directory tree when already there is one
;; 3. use my favarite key binding
;;
;; So I wrote this one use `tree-mode'.
;;
;; See also:
;; http://www.splode.com/~friedman/software/emacs-lisp/src/dirtree.el
;; http://svn.halogen.kharkov.ua/svn/repos/alex-emacs-settings/emhacks/dir-tree.el
;; Put this file into your load-path and the following into your ~/.emacs:
;; (autoload 'dirtree "dirtree" "Add directory to tree view")
;;; Code:
(eval-when-compile
(require 'cl))
(require 'tree-mode)
(require 'windata)
(require 'dired-x)
(defgroup dirtree nil
"Directory tree views"
:group 'tools)
(defcustom dirtree-windata '(frame left 0.3 delete)
"*Arguments to set the window buffer display.
See `windata-display-buffer' for setup the arguments."
:type 'sexp
:group 'dirtree)
(defcustom dirtree-buffer "*dirtree*"
"*Buffer name for `dirtree'"
:type 'string
:group 'dirtree)
(define-widget 'dirtree-dir-widget 'tree-widget
"Directory Tree widget."
:dynargs 'dirtree-expand
:has-children t)
(define-widget 'dirtree-file-widget 'push-button
"File widget."
:format "%[%t%]\n"
:button-face 'default
:notify 'dirtree-select)
(defun dirtree-show ()
"Show `dirtree-buffer'. Create tree when no parent directory find."
(interactive)
(let ((buffer (get-buffer-create dirtree-buffer))
(dir default-directory)
trees tree button path)
(with-current-buffer buffer
(setq trees tree-mode-list)
(while (and trees
(not tree))
(if (string-match (concat "^" (regexp-quote (widget-get (car trees) :file))) dir)
;; if parent directory in buffer
(setq tree (car trees))
(setq trees (cdr trees)))))
(if tree
(progn
(setq path (split-string (file-relative-name buffer-file-name (widget-get tree :file)) "/"))
(dirtree (widget-get tree :file) t)
(setq button (tree-mode-find-node tree path))
(if button
(goto-char (widget-get (car button) :from))))
(call-interactively 'dirtree))))
(defun dirtree (root select)
"create tree of `root' directory
With prefix arguement select `dirtree-buffer'"
(interactive "DDirectory: \nP")
(let ((buffer (get-buffer-create dirtree-buffer))
tree win)
(with-current-buffer buffer
(unless (eq major-mode 'dirtree-mode)
(dirtree-mode))
(dolist (atree tree-mode-list)
(if (string= (widget-get atree :file) root)
(setq tree atree)))
(or tree
(setq tree (tree-mode-insert (dirtree-root-widget root)))))
(setq win (get-buffer-window dirtree-buffer))
(unless win
(setq win (apply 'windata-display-buffer dirtree-buffer dirtree-windata))
(select-window win))
(with-selected-window win
(unless (widget-get tree :open)
(widget-apply-action tree))
(goto-char (widget-get tree :from))
(recenter 1))
(if select
(select-window win))))
(define-derived-mode dirtree-mode tree-mode "Dir-Tree"
"A mode to display tree of directory"
(tree-widget-set-theme "folder"))
(defun dirtree-root-widget (directory)
"create the root directory"
`(dirtree-dir-widget
:node (dirtree-file-widget
:tag ,directory
:file ,directory)
:file ,directory
:open t))
(defun dirtree-expand (tree)
"expand directory"
(or (widget-get tree :args)
(let ((directory (widget-get tree :file))
(re (dired-omit-regexp))
dirs files basename)
(dolist (file (directory-files directory t))
(setq basename (file-name-nondirectory file))
(unless (string-match re basename)
(if (file-directory-p file)
(push (cons file basename) dirs)
(push (cons file basename) files))))
(setq dirs (sort dirs (lambda (a b) (string< (cdr a) (cdr b)))))
(setq files (sort files (lambda (a b) (string< (cdr a) (cdr b)))))
(append
(mapcar (lambda (file)
`(dirtree-dir-widget
:file ,(car file)
:node (dirtree-file-widget
:tag ,(cdr file)
:file ,(car file))))
dirs)
(mapcar (lambda (file)
`(dirtree-file-widget
:file ,(car file)
:tag ,(cdr file)))
files)))))
(defun dirtree-select (node &rest ignore)
"Open file in other window"
(let ((file (widget-get node :file)))
(and file
(find-file-other-window file))))
(defun dirtree-display ()
"Open file under point"
(interactive)
(let ((widget (widget-at (1- (line-end-position))))
file)
(if (setq file (widget-get widget :file))
(find-file-other-window file))))
(define-key dirtree-mode-map "\C-o" 'dirtree-display)
(provide 'dirtree)
;;; dirtree.el ends here

194
vendor/imenu-tree.el vendored
View File

@@ -1,194 +0,0 @@
;;; imenu-tree.el --- A mode to view imenu using tree-widget
;; Copyright 2007 Ye Wenbin
;;
;; Author: wenbinye@163.com
;; Version: $Id: imenu-tree.el,v 1.2 2007/02/16 14:36:10 ywb Exp ywb $
;; Keywords:
;; X-URL: not distributed yet
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;;
;; Put this file into your load-path and the following into your ~/.emacs:
;; (require 'imenu-tree)
;;; Code:
(provide 'imenu-tree)
(eval-when-compile
(require 'cl))
(require 'imenu)
(require 'tree-mode)
(defgroup imenu-tree nil
"Display imenu using tree-widget"
:group 'convenience)
(defcustom imenu-tree-create-buffer-function nil
"A function to create buffer for insert imenu tree"
:group 'imenu-tree
:type 'function)
(defcustom imenu-tree-name `(concat mode-name ": " (or (buffer-name) "<NIL>"))
"tree imenu root name"
:group 'imenu-tree
:type 'sexp)
(defvar imenu-tree-window-width 40)
(defvar imenu-tree-icons
'(("Types" . "function")))
(defcustom imenu-tree-window-function
(lambda (trbuf buf)
(delete-other-windows)
(let* ((w1 (selected-window))
(w2 (split-window w1 imenu-tree-window-width t)))
(set-window-buffer w1 trbuf)
(set-window-buffer w2 buf)
(other-window 1)
))
"Function to set the window buffer display"
:group 'imenu-tree
:type 'function)
(defvar imenu-tree-buffer nil)
(defvar imenu-tree nil)
(define-derived-mode imenu-tree-mode tree-mode "Imenu-Tree"
"A mode to display tree of imenu"
(tree-widget-set-theme "imenu")
(add-hook 'tree-mode-delete-tree-hook 'tree-mode-kill-buffer))
(defun imenu-tree (arg)
"Display a tree of IMENU. With prefix argument, select imenu
tree buffer window."
(interactive "P")
(let ((old-tree (and (local-variable-p 'imenu-tree) imenu-tree))
(buf (current-buffer))
tree)
(if (and (local-variable-p 'imenu-tree-buffer)
(buffer-live-p imenu-tree-buffer))
(with-current-buffer imenu-tree-buffer
(if (and old-tree (member old-tree tree-mode-list))
(setq tree old-tree)
(setq tree (tree-mode-insert (imenu-tree-widget buf)))))
(let ((buffer (if (functionp imenu-tree-create-buffer-function)
(funcall imenu-tree-create-buffer-function buf)
(get-buffer-create "*imenu-tree*"))))
(set (make-local-variable 'imenu-tree-buffer) buffer)
(add-hook 'kill-buffer-hook 'imenu-tree-kill nil t)
(with-current-buffer buffer
(unless (eq major-mode 'imenu-tree-mode)
(imenu-tree-mode))
(setq tree (tree-mode-insert (imenu-tree-widget buf))))))
(set (make-local-variable 'imenu-tree) tree)
;; if imenu-tree-buffer is visible, do nothing
(unless (get-buffer-window imenu-tree-buffer)
(switch-to-buffer imenu-tree-buffer)
(funcall imenu-tree-window-function (current-buffer) buf))
(let ((win (get-buffer-window imenu-tree-buffer)))
(with-selected-window win
(unless (widget-get tree :open)
(widget-apply-action tree))
(goto-char (widget-get tree :from))
(recenter 1))
(if arg
(select-window (get-buffer-window imenu-tree-buffer))))))
(defun imenu-tree-kill ()
(let ((tree imenu-tree))
(when (and imenu-tree-buffer
(buffer-live-p imenu-tree-buffer))
(with-current-buffer imenu-tree-buffer
(tree-mode-delete tree)))))
(defun imenu-tree-widget (buf)
`(tree-widget
:node (push-button
:tag ,(with-current-buffer buf
(eval imenu-tree-name))
:format "%[%t%]\n"
:notify tree-mode-reflesh-parent)
:dynargs imenu-tree-expand
:has-children t
:buffer ,buf
:open t))
(defun imenu-tree-select (node &rest ignore)
(let ((marker (widget-get node :imenu-marker)))
(select-window (display-buffer (marker-buffer marker)))
(goto-char marker)))
(defun imenu-tree-expand-bucket (bucket)
(let ((name (widget-get (widget-get bucket :node) :tag))
(tree (widget-get bucket :parent)))
(mapcar (lambda (item)
`(push-button
:tag ,(car item)
:imenu-marker ,(cdr item)
:format "%[%t%]\n"
:button-icon ,(or (assoc-default name imenu-tree-icons)
"other")
:notify imenu-tree-select))
(cdr (assoc name (with-current-buffer (widget-get tree :buffer)
imenu--index-alist))))))
(defun imenu-tree-expand (tree)
(or (widget-get tree :args)
(let* ((buf (widget-get tree :buffer))
(imenu-auto-rescan t)
(idx (save-excursion
(set-buffer buf)
(reverse (imenu--make-index-alist t))))
widgets)
(dolist (item idx)
(if (listp (cdr item))
(push `(tree-widget
:node (push-button
:tag ,(car item)
:button-icon "bucket"
:notify tree-mode-reflesh-parent
:format "%[%t%]\n")
:dynargs imenu-tree-expand-bucket
:has-children t)
widgets)
(unless (and (string= "*Rescan*" (car item))
(numberp (cdr item)))
(push `(push-button
:tag ,(car item)
:imenu-marker ,(cdr item)
:button-icon "function"
:format "%[%t%]\n"
:notify imenu-tree-select)
widgets))))
widgets)))
(defun imenu-tree-display ()
(interactive)
(let ((widget (widget-at (1- (line-end-position))))
marker)
(if (setq marker (widget-get widget :imenu-marker))
(with-selected-window (display-buffer (marker-buffer marker))
(goto-char marker)))))
(define-key imenu-tree-mode-map "\C-o" 'imenu-tree-display)
;;; imenu-tree.el ends here

349
vendor/tree-mode.el vendored
View File

@@ -1,349 +0,0 @@
;;; tree-mode.el --- A mode to create and manage tree widgets
;; Copyright 2007 Ye Wenbin
;;
;; Author: wenbinye@163.com
;; Version: $Id: tree-mode.el,v 1.3 2007/02/17 06:37:54 ywb Exp ywb $
;; Keywords:
;; X-URL: not distributed yet
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;;
;; Put this file into your load-path and the following into your ~/.emacs:
;; (require 'tree-mode)
;;; Code:
(provide 'tree-mode)
(require 'tree-widget)
(eval-when-compile
(require 'cl))
(defvar tree-mode-list nil)
(defvar tree-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map widget-keymap)
(define-key map "p" 'tree-mode-previous-node)
(define-key map "n" 'tree-mode-next-node)
(define-key map "j" 'tree-mode-next-sib)
(define-key map "k" 'tree-mode-previous-sib)
(define-key map "u" 'tree-mode-goto-parent)
(define-key map "r" 'tree-mode-goto-root)
(define-key map "g" 'tree-mode-reflesh)
(define-key map "e" 'tree-mode-expand-level)
(define-key map "!" 'tree-mode-collapse-other-except)
(dotimes (i 10)
(define-key map `[,(+ ?0 i)] 'digit-argument))
map))
(defvar tree-mode-insert-tree-hook nil
"Hooks run after insert a tree into buffer. Each function is
passed the new tree created")
(defvar tree-mode-delete-tree-hook nil
"Hooks run after delete a tree in the buffer. Each function is
passed the new tree created")
(defun tree-mode-reflesh-tree (tree)
(if (widget-get tree :dynargs)
(widget-put tree :args nil)
(if (widget-get tree :old-args)
(widget-put tree :args (widget-get tree :old-args))))
(widget-value-set tree (widget-value tree)))
(defun tree-mode-reflesh-parent (widget &rest ignore)
"Put this function to :notify property of tree-widget node."
(tree-mode-reflesh-tree (widget-get widget :parent)))
(define-derived-mode tree-mode nil "Tree"
"A mode to manage many tree widgets"
(make-local-variable 'tree-mode-list)
(make-local-variable 'tree-mode-insert-tree-hook)
(make-local-variable 'tree-mode-delete-tree-hook)
(widget-setup))
(add-hook 'tree-widget-before-create-icon-functions
'tree-mode-icon-create)
(defun tree-mode-icon-create (icon)
(let ((img (widget-get (widget-get icon :node) :button-icon)))
(if img (widget-put icon :glyph-name img))))
(defun tree-mode-insert (tree &optional before)
(if before
(goto-char (widget-get before :from))
(goto-char (point-max)))
(setq tree (widget-create tree))
(setq tree-mode-list (append tree-mode-list (list tree)))
(run-hook-with-args 'tree-mode-insert-tree-hook tree)
tree)
(defun tree-mode-delete (tree)
(setq tree-mode-list (delq tree tree-mode-list))
(widget-delete tree)
(run-hook-with-args 'tree-mode-delete-tree-hook tree))
(defun tree-mode-tree-buffer (tree)
(marker-buffer (widget-get tree :from)))
(defun tree-mode-kill-buffer (&rest ignore)
(if (= (length tree-mode-list) 0)
(kill-buffer (current-buffer))))
;;{{{ Predicate and others
(defun tree-mode-root-treep (tree)
(and (tree-widget-p tree)
(null (widget-get tree :parent))))
(defun tree-mode-tree-linep ()
"If there is tree-widget in current line, return t."
(let ((wid (tree-mode-icon-current-line)))
(and wid (not (tree-widget-leaf-node-icon-p wid)))))
(defun tree-mode-root-linep ()
"If the root tree node in current line, return t"
(let ((wid (tree-mode-icon-current-line)))
(and wid (not (tree-widget-leaf-node-icon-p wid))
(null (widget-get (widget-get wid :parent) :parent)))))
(defun tree-mode-icon-current-line ()
"Return the icon widget in current line"
(save-excursion
(forward-line 0)
(or (widget-at)
(progn (widget-forward 1)
(widget-at)))))
(defun tree-mode-button-current-line ()
(widget-at (1- (line-end-position))))
(defun tree-mode-parent-current-line ()
"If current line is root line, return the root tree, otherwise
return the parent tree"
(let ((wid (tree-mode-icon-current-line))
parent)
(when wid
(if (tree-widget-leaf-node-icon-p wid)
(widget-get wid :parent)
(setq parent (widget-get (widget-get wid :parent) :parent))
(or parent (widget-get wid :parent))))))
(defun tree-mode-widget-root (wid)
(let (parent)
(while (setq parent (widget-get wid :parent))
(setq wid parent))
wid))
(defun tree-mode-tree-ap (&optional pos)
"Return the root tree at point"
(save-excursion
(if pos (goto-char pos))
(tree-mode-widget-root (tree-mode-icon-current-line))))
;;}}}
;;{{{ Movement commands
(defun tree-mode-next-node (arg)
(interactive "p")
(widget-forward (* arg 2)))
(defun tree-mode-previous-node (arg)
(interactive "p")
(tree-mode-next-node (- arg)))
(defun tree-mode-next-sib (arg)
(interactive "p")
(let (me siblings sib others out-range)
(if (tree-mode-root-linep)
(setq me (tree-mode-tree-ap)
siblings tree-mode-list)
(let ((parent (tree-mode-parent-current-line)))
(setq me (tree-mode-button-current-line))
(if (tree-mode-tree-linep)
(setq me (widget-get me :parent)))
(setq siblings (widget-get parent :children))))
(setq others (member me siblings))
(if (> arg 0)
(setq sib
(if (>= arg (length others))
(progn
(setq out-range t)
(car (last others)))
(nth arg others)))
(setq sib (- (length siblings)
(length others)
(- arg))
out-range (< sib 0))
(setq sib (nth (max 0 sib) siblings)))
(goto-char (widget-get sib :from))
(if out-range
(message "No %s sibling more!" (if (< arg 0) "previous" "next")))))
(defun tree-mode-previous-sib (arg)
(interactive "p")
(tree-mode-next-sib (- arg)))
(defun tree-mode-goto-root ()
(interactive)
(let ((root (tree-mode-tree-ap)))
(if root
(goto-char (widget-get root :from))
(message "No Root!"))))
(defun tree-mode-goto-parent (arg)
(interactive "p")
(let ((parent (tree-mode-parent-current-line)))
(setq arg (1- arg))
(if parent
(progn
(goto-char (widget-get parent :from))
(while (and (> arg 0)
(setq parent (widget-get parent :parent))
(goto-char (widget-get parent :from))
(setq arg (1- arg)))))
(message "No parent!"))))
;;}}}
;;{{{ Expand or collapse
(defun tree-mode-collapse-other-except ()
(interactive)
(let ((me (tree-mode-icon-current-line)))
(if (tree-widget-leaf-node-icon-p me)
(message "Not a tree under point!")
(setq me (widget-get me :parent))
(unless (widget-get me :open)
(widget-apply-action me))
(mapc (lambda (tree)
(if (widget-get tree :open)
(widget-apply-action tree)))
(remq me (if (tree-mode-root-treep me)
tree-mode-list
(widget-get (widget-get me :parent)
:children)))))))
(defun tree-mode-collapse-children (tree)
(mapc (lambda (child)
(if (widget-get child :open)
(widget-apply-action child)))
(widget-get tree :children)))
(defun tree-mode-expand-children (tree)
(mapc (lambda (child)
(if (and (tree-widget-p child)
(not (widget-get child :open)))
(widget-apply-action child)))
(widget-get tree :children)))
(defun tree-mode-expand-level (level)
"Expand tree to LEVEL. With prefix argument 0 or negative, will
expand all leaves of the tree."
(interactive "p")
(let ((me (tree-mode-icon-current-line)))
(if (tree-widget-leaf-node-icon-p me)
(message "Not a tree under point!")
(setq me (widget-get me :parent))
(tree-mode-expand-level-1 me (1- level)))))
(defun tree-mode-expand-level-1 (tree level)
(when (tree-widget-p tree)
(if (not (widget-get tree :open))
(widget-apply-action tree))
(if (= level 0)
(tree-mode-collapse-children tree)
(mapc (lambda (child)
(tree-mode-expand-level-1 child (1- level)))
(widget-get tree :children)))))
;;}}}
(defun tree-mode-node-tag (node)
(or (widget-get node :tag)
(widget-get (widget-get node :node) :tag)))
;;{{{ Commands about tree nodes
(defun tree-mode-backup-args (widget)
(unless (and (widget-get widget :dynargs)
(null (widget-get widget :old-args)))
;; if widget don't have a dynamic args function
;; restore args to old-args for recover
(widget-put widget :old-args (copy-sequence (widget-get widget :args)))))
(defun tree-mode-filter-children (widget filter)
(tree-mode-backup-args widget)
(widget-put widget :args
(delq nil (mapcar (lambda (child)
(if (funcall filter child)
child))
(widget-get widget :args))))
(widget-value-set widget (widget-value widget)))
(defun tree-mode-sort-by-nchild (wid1 wid2)
"Sort node by which node has children"
(widget-get wid1 :children))
(defun tree-mode-sort-children (widget sorter)
(tree-mode-backup-args widget)
(widget-put widget :args
(sort (copy-sequence (widget-get widget :args)) sorter))
(widget-value-set widget (widget-value widget)))
(defun tree-mode-sort-by-tag (arg)
(interactive "P")
(let ((tree (tree-mode-parent-current-line)))
(if tree
(tree-mode-sort-children tree
(lambda (w1 w2)
(or (tree-mode-sort-by-nchild w1 w2)
(string< (tree-mode-node-tag w1)
(tree-mode-node-tag w2)))))
(message "No tree at point!"))))
(defun tree-mode-delete-match (regexp)
(interactive "sDelete node match: ")
(let ((tree (tree-mode-parent-current-line)))
(if tree
(tree-mode-filter-children
tree
(lambda (child) (not (string-match regexp (tree-mode-node-tag child)))))
(message "No tree at point!"))))
(defun tree-mode-keep-match (regexp)
(interactive "sKeep node match: ")
(let ((tree (tree-mode-parent-current-line)))
(if tree
(tree-mode-filter-children
tree
(lambda (child) (string-match regexp (tree-mode-node-tag child))))
(message "No tree at point!"))))
(defun tree-mode-reflesh ()
"Reflesh parent tree."
(interactive)
(let ((tree (tree-mode-parent-current-line)))
(if tree
(tree-mode-reflesh-tree tree)
(message "No tree at point!"))))
(defun tree-mode-delete-tree ()
"Delete a tree from buffer."
(interactive)
(if (tree-mode-root-linep)
(if (yes-or-no-p "Delete current tree? ")
(tree-mode-delete (tree-mode-tree-ap)))
(message "No tree at point!")))
;;}}}
;;; tree-mode.el ends here

View File

@@ -1,133 +0,0 @@
/* XPM */
static char * Variables_xpm[] = {
"16 14 116 2",
" c None",
". c #000000",
"+ c #C2CBDF",
"@ c #8AAAEA",
"# c #83A1DE",
"$ c #6F8FD3",
"% c #FFFFFF",
"& c #B2C5EB",
"* c #5B79BF",
"= c #688AD5",
"- c #6180C3",
"; c #7193DC",
"> c #6B89C9",
", c #4F648E",
"' c #848484",
") c #8B8B8B",
"! c #616161",
"~ c #3B3B3B",
"{ c #A0B1D4",
"] c #6789D6",
"^ c #617FC3",
"/ c #7091DA",
"( c #6988C8",
"_ c #7B9CE2",
": c #475A80",
"< c #D1D1D1",
"[ c #C6C6C6",
"} c #545454",
"| c #6B6A6A",
"1 c #617EC3",
"2 c #6F91DA",
"3 c #6987C7",
"4 c #7A9CE1",
"5 c #7390CD",
"6 c #717070",
"7 c #F2F2F2",
"8 c #5E5E5E",
"9 c #5B5B5B",
"0 c #626262",
"a c #444444",
"b c #696D76",
"c c #5F687B",
"d c #5A6273",
"e c #626B7C",
"f c #5D6574",
"g c #656D7E",
"h c #535761",
"i c #4C4C4C",
"j c #6F6F6F",
"k c #BCBCBC",
"l c #C6C5C6",
"m c #737373",
"n c #D5DFF3",
"o c #A7B7D9",
"p c #B6C7EB",
"q c #ACBBDB",
"r c #BACBEE",
"s c #AFBEDC",
"t c #9EA9BF",
"u c #6B6B6B",
"v c #696969",
"w c #C5C5C5",
"x c #BBBBBB",
"y c #787879",
"z c #B2C2DF",
"A c #A0ABC1",
"B c #969FB3",
"C c #9FAAC0",
"D c #949EB2",
"E c #9EA9BE",
"F c #939DB1",
"G c #717171",
"H c #EEEDED",
"I c #F9F9F9",
"J c #EBEBEA",
"K c #F6F7F7",
"L c #E9E9E9",
"M c #F3F4F3",
"N c #E6E6E6",
"O c #F1F0F1",
"P c #C2C2C2",
"Q c #B7B8B7",
"R c #F5F5F5",
"S c #E7E8E8",
"T c #E5E5E5",
"U c #EFF0F0",
"V c #E2E2E2",
"W c #ECEDED",
"X c #DFDFDF",
"Y c #B7B7B8",
"Z c #C0C1C1",
"` c #D6D6D6",
" . c #E0E0E0",
".. c #D4D4D4",
"+. c #DFDEDE",
"@. c #D3D3D3",
"#. c #DDDDDD",
"$. c #D1D2D1",
"%. c #DCDCDC",
"&. c #C7C7C7",
"*. c #BDBDBD",
"=. c #484847",
"-. c #C1C1C0",
";. c #F1F1F0",
">. c #E3E3E3",
",. c #EBEBEB",
"'. c #DEDEDE",
"). c #E8E9E8",
"!. c #DCDBDB",
"~. c #EDEDEE",
"{. c #EAEBEB",
"]. c #E9E8E9",
"^. c #DCDCDB",
"/. c #E7E7E6",
"(. c #646464",
"_. c #040404",
" _._._._._._._._. ",
" _.+ @ # @ # @ $ % ",
" _.& * = - ; > , ' ) ! ~ ",
" ' _.{ ] ^ / ( _ : < [ } | % ",
" ! < _.& 1 2 3 4 5 , [ } [ 6 7 ",
"8 9 0 a b c d e f g h i [ < | % ",
"j k l m n o p q r s t u < [ 6 7 ",
"v w x y z A B C D E F G [ < | % ",
"j x w H I J K L M N O u < [ 6 7 ",
"v P Q R S 7 T U V W X G [ < | % ",
"j Y Z ` ...+.@.#.$.%.u &.*.=.7 ",
"v -.` ;.>.H .,.'.).!.G [ 0 7 ",
"j ` 7 >.~. .{.'.].^./.u 0 7 ",
"v j v j v j v j v j v (.7 "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

View File

@@ -1,40 +0,0 @@
/* XPM */
static char * close_xpm[] = {
"16 22 15 1",
" c None",
". c #848400",
"+ c #E7E79C",
"@ c #E7E794",
"# c #DEDE8C",
"$ c #ADAD39",
"% c #ADAD42",
"& c #B5B54A",
"* c #B5B552",
"= c #BDBD5A",
"- c #9C9C29",
"; c #A5A531",
"> c #C6C663",
", c #C6C66B",
"' c #CECE73",
" ",
" ",
" ",
" ",
" ",
" ",
" .... ",
".+@@#....... ",
".....$%%&&*=. ",
".-;;$%%&&*==. ",
".;;$%%&&*===. ",
".;$%%&&*===>. ",
".$%%&&*===>,. ",
".%%&&*===>,,. ",
".%&&*===>,,'. ",
"............. ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

View File

@@ -1,35 +0,0 @@
/* XPM */
static char * empty_xpm[] = {
"16 22 10 1",
" c None",
". c #424242",
"+ c #A5A5A5",
"@ c #9C9C9C",
"# c #949494",
"$ c #8C8C8C",
"% c #6B6B6B",
"& c #737373",
"* c #7B7B7B",
"= c #848484",
" ",
" ",
" ",
" ",
" ",
" ",
" .... ",
".+++@..... ",
".++@@@##$$. ",
".+@.......... ",
".@.%%%&&&**==. ",
".@.%%&&&**==. ",
"..%%&&&**===. ",
"..%&&&**===. ",
".%&&&**===$. ",
"........... ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

View File

@@ -1,27 +0,0 @@
/* XPM */
static char * end_guide_xpm[] = {
"6 22 2 1",
" c None",
". c #ADA5C6",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@@ -1,36 +0,0 @@
/* XPM */
static char * ecb_function_public_xpm[] = {
"16 14 19 1",
" c None",
". c #005D00",
"+ c #F2F2F2",
"@ c #3CBA00",
"# c #FFFFFF",
"$ c #040404",
"% c #E5A684",
"& c #E2B7A1",
"* c #DF966D",
"= c #CB7441",
"- c #532923",
"; c #CA713E",
"> c #DB8958",
", c #D48E67",
"' c #4F2721",
") c #CB733F",
"! c #DB8757",
"~ c #DEAC90",
"{ c #EEC1AA",
" ",
" ...+ ",
" .@#@.+ ",
" .# +.# ",
" $$$$++ .....+ ",
" $%&*=-+ ..@..# ",
"$%&;=>,-+.@#@.+ ",
"$&;=>,%'#..@..# ",
"$*)!,%~-+.....+ ",
"$)>,%~{'#+#+#+# ",
"+$,%~{'# ",
" +-'-'# ",
" +#+# ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

View File

@@ -1,27 +0,0 @@
/* XPM */
static char * guide_xpm[] = {
"6 22 2 1",
" c None",
". c #ADA5C6",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" .",
" ",
" ."};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

View File

@@ -1,27 +0,0 @@
/* XPM */
static char * handle_xpm[] = {
"10 22 2 1",
" c None",
". c #ADA5C6",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" . . . . .",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

View File

@@ -1,34 +0,0 @@
/* XPM */
static char * leaf_xpm[] = {
"16 22 9 1",
" c None",
". c #424242",
"+ c #949494",
"@ c #9C9C9C",
"# c #A5A5A5",
"$ c #ADADAD",
"% c #848484",
"& c #B5B5B5",
"* c #BDBDBD",
" ",
" ",
" ",
" ",
" ",
"....... ",
".++@@#.. ",
".+@@##.$. ",
".@@###.... ",
".@%%%+%$&. ",
".###$$$&&. ",
".#%+%%%&*. ",
".#$$$&&**. ",
".$%%+%%**. ",
".$$&&****. ",
".$&&*****. ",
".......... ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

View File

@@ -1,26 +0,0 @@
/* XPM */
static char * no_guide_xpm[] = {
"6 22 1 1",
" c None",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

View File

@@ -1,26 +0,0 @@
/* XPM */
static char * no_handle_xpm[] = {
"10 22 1 1",
" c None",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

View File

@@ -1,39 +0,0 @@
/* XPM */
static char * open_xpm[] = {
"16 22 14 1",
" c None",
". c #848400",
"+ c #D6D67B",
"@ c #CECE7B",
"# c #CECE73",
"$ c #C6C66B",
"% c #BDBD5A",
"& c #BDBD52",
"* c #ADAD39",
"= c #ADAD42",
"- c #B5B54A",
"; c #C6C663",
"> c #CECE6B",
", c #A5A5C6",
" ",
" ",
" ",
" ",
" ",
" ",
" .... ",
".+@@#..... ",
".@@##$$%%&. ",
".@#.......... ",
".#.*==--&%%;;. ",
".#.==--&%%;;. ",
"..==--&%%;;$. ",
"..=--&%%;;$. ",
".=--&%%;;$>. ",
"........... ",
" ",
" , ",
" ",
" , ",
" ",
" , "};

View File

@@ -1,56 +0,0 @@
/* XPM */
static char * ecb_variable_public_xpm[] = {
"16 14 39 1",
" c None",
". c #005D00",
"+ c #F2F2F2",
"@ c #3CBA00",
"# c #FFFFFF",
"$ c #040404",
"% c #000000",
"& c #C2CBDF",
"* c #8AAAEA",
"= c #83A1DE",
"- c #6F8FD3",
"; c #B2C5EB",
"> c #6080C9",
", c #688AD5",
"' c #6687CD",
") c #7193DC",
"! c #7190D4",
"~ c #4F648E",
"{ c #A9BBDF",
"] c #6789D6",
"^ c #6686CD",
"/ c #7091DA",
"( c #7B9CE2",
"_ c #4B5F87",
": c #6685CD",
"< c #6F91DA",
"[ c #6F8ED2",
"} c #7A9CE1",
"| c #7998D8",
"1 c #6E8FD9",
"2 c #6D8DD2",
"3 c #799AE0",
"4 c #7897D7",
"5 c #83A4E6",
"6 c #6D8CD1",
"7 c #7899DF",
"8 c #7896D7",
"9 c #83A3E6",
"0 c #809EDC",
" ",
" ...+ ",
" .@#@.+ ",
" .# +.# ",
"$$$$$$$% .....+ ",
"$&*=*=*-#..@..# ",
"$;>,')!~+.@#@.+ ",
"${]^/-(_#..@..# ",
"$;:<[}|~+.....+ ",
"${12345_#+#+#+# ",
"$;67890~+ ",
"$=~_~_~_# ",
" #+#+#+#+ ",
" "};

View File

@@ -1,56 +0,0 @@
/* XPM */
static char * ecb_variable_public_xpm[] = {
"16 14 39 1",
" c None",
". c #005D00",
"+ c #F2F2F2",
"@ c #3CBA00",
"# c #FFFFFF",
"$ c #040404",
"% c #000000",
"& c #C2CBDF",
"* c #8AAAEA",
"= c #83A1DE",
"- c #6F8FD3",
"; c #B2C5EB",
"> c #6080C9",
", c #688AD5",
"' c #6687CD",
") c #7193DC",
"! c #7190D4",
"~ c #4F648E",
"{ c #A9BBDF",
"] c #6789D6",
"^ c #6686CD",
"/ c #7091DA",
"( c #7B9CE2",
"_ c #4B5F87",
": c #6685CD",
"< c #6F91DA",
"[ c #6F8ED2",
"} c #7A9CE1",
"| c #7998D8",
"1 c #6E8FD9",
"2 c #6D8DD2",
"3 c #799AE0",
"4 c #7897D7",
"5 c #83A4E6",
"6 c #6D8CD1",
"7 c #7899DF",
"8 c #7896D7",
"9 c #83A3E6",
"0 c #809EDC",
" ",
" ...+ ",
" .@#@.+ ",
" .# +.# ",
"$$$$$$$% .....+ ",
"$&*=*=*-#..@..# ",
"$;>,')!~+.@#@.+ ",
"${]^/-(_#..@..# ",
"$;:<[}|~+.....+ ",
"${12345_#+#+#+# ",
"$;67890~+ ",
"$=~_~_~_# ",
" #+#+#+#+ ",
" "};

259
vendor/windata.el vendored
View File

@@ -1,259 +0,0 @@
;;; windata.el --- convert window configuration to list
;; Copyright 2007 Ye Wenbin
;;
;; Author: wenbinye@gmail.com
;; Version: $Id: windata.el,v 0.0 2007/12/13 00:32:15 ywb Exp $
;; Keywords: convenience, frames
;;
;; This file is part of PDE (Perl Development Environment).
;; But it is useful for generic programming.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; This extension is useful when you want save window configuration
;; between emacs sessions or for emacs lisp programer who want handle
;; window layout.
;;; Dependencies:
;; no extra libraries is required
;; Put this file into your load-path and the following into your ~/.emacs:
;; (require 'windata)
;; You can use desktop to save window configuration between different
;; session:
;; (require 'desktop)
;; (add-to-list 'desktop-globals-to-save 'windata-named-winconf)
;;; Code:
(eval-when-compile
(require 'cl))
(defvar windata-named-winconf nil
"Name of all window configuration")
(defvar windata-data-function 'windata-data-default
"Function to save window data.
The data should be persistent permanent.")
(defvar windata-data-restore-function 'windata-data-restore-default
"Function to restore window data.")
(defvar windata-total-width nil
"Internal variable.")
(defvar windata-total-height nil
"Internal variable.")
(defun windata-fix (arg fix)
"Round the ARG with FIX decimal.
(windata-fix 0.123456 4) => 0.1234"
(let ((n (expt 10 fix)))
(/ (float (floor (* arg n))) n)))
(defun windata-window-width (win)
(let ((width (if (windowp win)
(window-width win)
(let ((edge (cadr win)))
(- (nth 2 edge) (car edge))))))
(windata-fix (/ width windata-total-width) 4)))
(defun windata-window-height (win)
(let ((height (if (windowp win)
(window-height win)
(let ((edge (cadr win)))
(- (nth 3 edge) (cadr edge))))))
(windata-fix (/ height windata-total-height) 4)))
(defun windata-data-default (win)
(buffer-name (window-buffer win)))
(defun windata-data-restore-default (win name)
(and (buffer-live-p (get-buffer name))
(set-window-buffer win (get-buffer name))))
(defun windata-window-tree->list (tree)
(if (windowp tree)
(funcall windata-data-function tree)
(let ((dir (car tree))
(children (cddr tree)))
(list (if dir 'vertical 'horizontal)
(if dir
(windata-window-height (car children))
(windata-window-width (car children)))
(windata-window-tree->list (car children))
(if (> (length children) 2)
(windata-window-tree->list (cons dir (cons nil (cdr children))))
(windata-window-tree->list (cadr children)))))))
(defun windata-list->window-tree (conf)
(if (listp conf)
(let ((newwin
(if (eq (car conf) 'horizontal)
(split-window nil (floor (* (cadr conf) windata-total-width)) t)
(split-window nil (floor (* (cadr conf) windata-total-height))))))
(windata-list->window-tree (nth 2 conf))
(select-window newwin)
(windata-list->window-tree (nth 3 conf)))
(funcall windata-data-restore-function (selected-window) conf)))
(defun windata-window-path (tree win &optional path)
(if (windowp tree)
(if (eq win tree)
path)
(let ((children (cddr tree))
(i 0)
conf)
(while children
(setq conf (windata-window-path (car children) win (append path (list i))))
(if conf
(setq children nil)
(setq i (1+ i)
children (cdr children))))
conf)))
(defun windata-current-winconf ()
(let ((tree (car (window-tree)))
(windata-total-width (float (frame-width)))
(windata-total-height (float (frame-height))))
(cons (windata-window-tree->list tree)
(windata-window-path tree (selected-window)))))
(defun windata-restore-winconf (winconf &optional inside-p)
"Restore window configuration from `windata-current-winconf'.
When INSIDE-P is non-nil, that mean the window configuration
is restore in current window, that is to say not delete other
windows."
(let ((path (cdr winconf))
windata-total-width
windata-total-height
tree)
(if inside-p
(setq windata-total-width (float (window-width))
windata-total-height (float (window-height)))
(setq windata-total-width (float (frame-width))
windata-total-height (float (frame-height)))
(delete-other-windows))
(windata-list->window-tree (car winconf))
;; I don't know how to select the window when inside
(unless inside-p
(setq tree (car (window-tree)))
(while path
(setq tree (nth (car path) (cddr tree))
path (cdr path)))
(select-window tree))))
;; An example
;;;###autoload
(defun windata-name-winconf (name)
"Save window configuration with NAME.
After save the window configuration you can restore it by NAME using
`windata-restore-named-winconf'."
(interactive "sName of window configuration: ")
(setq windata-named-winconf
(cons
(cons name (windata-current-winconf))
(delq (assoc name windata-named-winconf) windata-named-winconf))))
;;;###autoload
(defun windata-restore-named-winconf (name)
"Restore saved window configuration."
(interactive (list (completing-read "Save named window configuration: "
windata-named-winconf nil t)))
(windata-restore-winconf (assoc-default name windata-named-winconf)))
;; To learn what the function behaves, you can eval these forms when two
;; or more window present in current frame.
;; (windata-display-buffer (get-buffer "*Messages*") nil 'top 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'bottom 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'left 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'right 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") t 'top 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") t 'bottom 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") t 'left 0.3 nil)
;; (windata-display-buffer (get-buffer "*Messages*") t 'right 0.3 nil)
;; ;; when delete-p is presented, the second parameter make no sense.
;; (windata-display-buffer (get-buffer "*Messages*") t 'top 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") t 'bottom 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") t 'left 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") t 'right 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'top 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'bottom 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'left 0.3 t)
;; (windata-display-buffer (get-buffer "*Messages*") nil 'right 0.3 t)
;;;###autoload
(defun windata-display-buffer (buf frame-p dir size &optional delete-p)
"Display buffer more precisely.
FRAME-P is non-nil and not window, the displayed buffer affect
the whole frame, that is to say, if DIR is right or left, the
displayed buffer will show on the right or left in the frame. If
it is nil, the buf will share space with current window.
DIR can be one of member of (right left top bottom).
SIZE is the displayed windowed size in width(if DIR is left or
right) or height(DIR is top or bottom). It can be a decimal which
will stand for percentage of window(frame) width(heigth)
DELETE-P is non-nil, the other window will be deleted before
display the BUF."
(or (get-buffer-window buf)
(let ((win (selected-window))
newwin horflag total)
(if (eq frame-p 'window)
(setq frame-p nil))
(if (eq delete-p 'no-delete)
(setq delete-p nil))
(if (memq dir '(left right))
;; '(top bottom))
(setq horflag t))
(setq total (if (or delete-p frame-p)
(if horflag
(frame-width)
(frame-height))
(if horflag
(window-width)
(window-height))))
(if (< size 1)
(setq size (floor (* total size))))
(if (memq dir '(right bottom))
(setq size (- total size)))
(if (or delete-p (not frame-p))
(progn
(and delete-p (delete-other-windows))
(setq newwin (split-window nil size horflag))
(when (memq dir '(left top))
(setq win newwin
newwin (selected-window)))
(set-window-buffer newwin buf)
(select-window win))
(let ((conf (windata-current-winconf))
(curbuf (current-buffer)))
(delete-other-windows)
(setq newwin (split-window nil size horflag))
(when (memq dir '(left top))
(setq win newwin
newwin (selected-window))
(select-window win))
(windata-restore-winconf conf t)
(set-window-buffer newwin buf)
(select-window (get-buffer-window curbuf))))
newwin)))
(provide 'windata)
;;; windata.el ends here