From b85dbf862fef1fb61332ba5cde313180f54338e4 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Fri, 11 Nov 2011 23:50:55 +0000 Subject: [PATCH] load in dirtree via el-get instead of custom added files to vendor directory --- packages.el | 12 +- vendor.el | 5 - vendor/dired-x.el | 1795 ------------------------ vendor/dirtree.el | 180 --- vendor/imenu-tree.el | 194 --- vendor/tree-mode.el | 349 ----- vendor/tree-widget/imenu/bucket.xpm | 133 -- vendor/tree-widget/imenu/close.png | Bin 298 -> 0 bytes vendor/tree-widget/imenu/close.xpm | 40 - vendor/tree-widget/imenu/empty.png | Bin 305 -> 0 bytes vendor/tree-widget/imenu/empty.xpm | 35 - vendor/tree-widget/imenu/end-guide.png | Bin 177 -> 0 bytes vendor/tree-widget/imenu/end-guide.xpm | 27 - vendor/tree-widget/imenu/function.xpm | 36 - vendor/tree-widget/imenu/guide.png | Bin 178 -> 0 bytes vendor/tree-widget/imenu/guide.xpm | 27 - vendor/tree-widget/imenu/handle.png | Bin 180 -> 0 bytes vendor/tree-widget/imenu/handle.xpm | 27 - vendor/tree-widget/imenu/leaf.png | Bin 336 -> 0 bytes vendor/tree-widget/imenu/leaf.xpm | 34 - vendor/tree-widget/imenu/no-guide.png | Bin 171 -> 0 bytes vendor/tree-widget/imenu/no-guide.xpm | 26 - vendor/tree-widget/imenu/no-handle.png | Bin 173 -> 0 bytes vendor/tree-widget/imenu/no-handle.xpm | 26 - vendor/tree-widget/imenu/open.png | Bin 344 -> 0 bytes vendor/tree-widget/imenu/open.xpm | 39 - vendor/tree-widget/imenu/other.xpm | 56 - vendor/tree-widget/imenu/variable.xpm | 56 - vendor/windata.el | 259 ---- 29 files changed, 11 insertions(+), 3345 deletions(-) delete mode 100644 vendor/dired-x.el delete mode 100644 vendor/dirtree.el delete mode 100644 vendor/imenu-tree.el delete mode 100644 vendor/tree-mode.el delete mode 100644 vendor/tree-widget/imenu/bucket.xpm delete mode 100644 vendor/tree-widget/imenu/close.png delete mode 100644 vendor/tree-widget/imenu/close.xpm delete mode 100644 vendor/tree-widget/imenu/empty.png delete mode 100644 vendor/tree-widget/imenu/empty.xpm delete mode 100644 vendor/tree-widget/imenu/end-guide.png delete mode 100644 vendor/tree-widget/imenu/end-guide.xpm delete mode 100644 vendor/tree-widget/imenu/function.xpm delete mode 100644 vendor/tree-widget/imenu/guide.png delete mode 100644 vendor/tree-widget/imenu/guide.xpm delete mode 100644 vendor/tree-widget/imenu/handle.png delete mode 100644 vendor/tree-widget/imenu/handle.xpm delete mode 100644 vendor/tree-widget/imenu/leaf.png delete mode 100644 vendor/tree-widget/imenu/leaf.xpm delete mode 100644 vendor/tree-widget/imenu/no-guide.png delete mode 100644 vendor/tree-widget/imenu/no-guide.xpm delete mode 100644 vendor/tree-widget/imenu/no-handle.png delete mode 100644 vendor/tree-widget/imenu/no-handle.xpm delete mode 100644 vendor/tree-widget/imenu/open.png delete mode 100644 vendor/tree-widget/imenu/open.xpm delete mode 100644 vendor/tree-widget/imenu/other.xpm delete mode 100644 vendor/tree-widget/imenu/variable.xpm delete mode 100644 vendor/windata.el diff --git a/packages.el b/packages.el index 366887c..3c270f3 100644 --- a/packages.el +++ b/packages.el @@ -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))) ;; diff --git a/vendor.el b/vendor.el index 4632758..035e4b3 100644 --- a/vendor.el +++ b/vendor.el @@ -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) \ No newline at end of file diff --git a/vendor/dired-x.el b/vendor/dired-x.el deleted file mode 100644 index f5505a7..0000000 --- a/vendor/dired-x.el +++ /dev/null @@ -1,1795 +0,0 @@ -;;; dired-x.el --- extra Dired functionality -*-byte-compile-dynamic: t;-*- - -;; Copyright (C) 1993, 1994, 1997, 2001, 2002, 2003, 2004, 2005, 2006, -;; 2007, 2008, 2009 Free Software Foundation, Inc. - -;; Author: Sebastian Kremer -;; Lawrence R. Dodd -;; Maintainer: Romain Francoise -;; Keywords: dired extensions files - -;; This file is part of GNU Emacs. - -;; GNU Emacs 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 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs 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 GNU Emacs. If not, see . - -;;; Commentary: - -;; This is Sebastian Kremer's excellent dired-x.el (Dired Extra), version -;; 1.191, hacked up for GNU Emacs. Redundant or conflicting material has -;; been removed or renamed in order to work properly with dired of GNU -;; Emacs. All suggestions or comments are most welcomed. - -;; -;; Please, PLEASE, *PLEASE* see the info pages. -;; - -;; BUGS: Type M-x dired-x-submit-report and a report will be generated. - -;; INSTALLATION: In your ~/.emacs, -;; -;; (add-hook 'dired-load-hook -;; (function (lambda () -;; (load "dired-x") -;; ;; Set global variables here. For example: -;; ;; (setq dired-guess-shell-gnutar "gtar") -;; ))) -;; (add-hook 'dired-mode-hook -;; (function (lambda () -;; ;; Set buffer-local variables here. For example: -;; ;; (dired-omit-mode 1) -;; ))) -;; -;; At load time dired-x.el will install itself, redefine some functions, and -;; bind some dired keys. *Please* see the info pages for more details. - -;; *Please* see the info pages for more details. - -;; User defined variables: -;; -;; dired-bind-vm -;; dired-vm-read-only-folders -;; dired-bind-jump -;; dired-bind-info -;; dired-bind-man -;; dired-x-hands-off-my-keys -;; dired-find-subdir -;; dired-enable-local-variables -;; dired-local-variables-file -;; dired-guess-shell-gnutar -;; dired-guess-shell-gzip-quiet -;; dired-guess-shell-znew-switches -;; dired-guess-shell-alist-user -;; dired-clean-up-buffers-too -;; dired-omit-mode -;; dired-omit-files -;; dired-omit-extensions -;; dired-omit-size-limit -;; -;; To find out more about these variables, load this file, put your cursor at -;; the end of any of the variable names, and hit C-h v [RET]. *Please* see -;; the info pages for more details. - -;; When loaded this code redefines the following functions of GNU Emacs -;; -;; Function Found in this file of GNU Emacs -;; -------- ------------------------------- -;; dired-clean-up-after-deletion ../lisp/dired.el -;; dired-find-buffer-nocreate ../lisp/dired.el -;; dired-initial-position ../lisp/dired.el -;; -;; dired-add-entry ../lisp/dired-aux.el -;; dired-read-shell-command ../lisp/dired-aux.el - - -;;; Code: - -;; LOAD. - -;; This is a no-op if dired-x is being loaded via `dired-load-hook'. It is -;; here in case the user has autoloaded dired-x via the dired-jump key binding -;; (instead of autoloading to dired as is suggested in the info-pages). - -(require 'dired) - -;; We will redefine some functions and also need some macros so we need to -;; load dired stuff of GNU Emacs. - -(require 'dired-aux) - -(defvar vm-folder-directory) -(eval-when-compile (require 'man)) - -;;; User-defined variables. - -(defgroup dired-x nil - "Extended directory editing (dired-x)." - :group 'dired) - -(defgroup dired-keys nil - "Dired keys customizations." - :prefix "dired-" - :group 'dired-x) - -(defcustom dired-bind-vm nil - "Non-nil means \"V\" runs `dired-vm', otherwise \"V\" runs `dired-rmail'. - -RMAIL files in the old Babyl format (used before before Emacs 23.1) -contain \"-*- rmail -*-\" at the top, so `dired-find-file' -will run `rmail' on these files. New RMAIL files use the standard -mbox format, and so cannot be distinguished in this way." - :type 'boolean - :group 'dired-keys) - -(defcustom dired-bind-jump t - "Non-nil means bind `dired-jump' to C-x C-j, otherwise do not." - :type 'boolean - :group 'dired-keys) - -(defcustom dired-bind-man t - "Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not." - :type 'boolean - :group 'dired-keys) - -(defcustom dired-bind-info t - "Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not." - :type 'boolean - :group 'dired-keys) - -(defcustom dired-vm-read-only-folders nil - "If non-nil, \\[dired-vm] will visit all folders read-only. -If neither nil nor t, e.g. the symbol `if-file-read-only', only -files not writable by you are visited read-only. - -Read-only folders only work in VM 5, not in VM 4." - :type '(choice (const :tag "off" nil) - (const :tag "on" t) - (other :tag "non-writable only" if-file-read-only)) - :group 'dired-x) - -(define-minor-mode dired-omit-mode - "Toggle Dired-Omit mode. -With numeric ARG, enable Dired-Omit mode if ARG is positive, disable -otherwise. Enabling and disabling is buffer-local. -If enabled, \"uninteresting\" files are not listed. -Uninteresting files are those whose filenames match regexp `dired-omit-files', -plus those ending with extensions in `dired-omit-extensions'." - :group 'dired-x - (if dired-omit-mode - ;; This will mention how many lines were omitted: - (let ((dired-omit-size-limit nil)) (dired-omit-expunge)) - (revert-buffer))) - -;; For backward compatibility -(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1") - -(defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$" - "Filenames matching this regexp will not be displayed. -This only has effect when `dired-omit-mode' is t. See interactive function -`dired-omit-mode' \(\\[dired-omit-mode]\) and variable -`dired-omit-extensions'. The default is to omit `.', `..', auto-save -files and lock files." - :type 'regexp - :group 'dired-x) - -(defcustom dired-find-subdir nil ; t is pretty near to DWIM... - "If non-nil, Dired always finds a directory in a buffer of its own. -If nil, Dired finds the directory as a subdirectory in some other buffer -if it is present as one. - -If there are several dired buffers for a directory, the most recently -used is chosen. - -Dired avoids switching to the current buffer, so that if you have -a normal and a wildcard buffer for the same directory, \\[dired] will -toggle between those two." - :type 'boolean - :group 'dired-x) - -(defcustom dired-omit-size-limit 30000 - "Maximum size for the \"omitting\" feature. -If nil, there is no maximum size." - :type '(choice (const :tag "no maximum" nil) integer) - :group 'dired-x) - -(defcustom dired-enable-local-variables t - "Control use of local-variables lists in Dired. -The value can be t, nil or something else. -A value of t means local-variables lists are obeyed; -nil means they are ignored; anything else means query. - -This temporarily overrides the value of `enable-local-variables' when listing -a directory. See also `dired-local-variables-file'." - :type 'boolean - :group 'dired-x) - -(defcustom dired-guess-shell-gnutar (when (or (eq system-type 'gnu) - (eq system-type 'gnu/linux)) - "tar") - "If non-nil, name of GNU tar executable. -\(E.g., \"tar\" or \"gtar\"). The `z' switch will be used with it for -compressed or gzip'ed tar files. If you don't have GNU tar, set this -to nil: a pipe using `zcat' or `gunzip -c' will be used." - :type '(choice (const :tag "Not GNU tar" nil) - (string :tag "Command name")) - :group 'dired-x) - -(defcustom dired-guess-shell-gzip-quiet t - "Non-nil says pass -q to gzip overriding verbose GZIP environment." - :type 'boolean - :group 'dired-x) - -(defcustom dired-guess-shell-znew-switches nil - "If non-nil, then string of switches passed to `znew', example: \"-K\"." - :type '(choice (const :tag "None" nil) - (string :tag "Switches")) - :group 'dired-x) - -(defcustom dired-clean-up-buffers-too t - "Non-nil means offer to kill buffers visiting files and dirs deleted in Dired." - :type 'boolean - :group 'dired-x) - -;;; KEY BINDINGS. - -(define-key dired-mode-map "\M-o" 'dired-omit-mode) -(define-key dired-mode-map "*O" 'dired-mark-omitted) -(define-key dired-mode-map "\M-(" 'dired-mark-sexp) -(define-key dired-mode-map "*(" 'dired-mark-sexp) -(define-key dired-mode-map "*." 'dired-mark-extension) -(define-key dired-mode-map "\M-!" 'dired-smart-shell-command) -(define-key dired-mode-map "w" 'dired-copy-filename-as-kill) -(define-key dired-mode-map "\M-G" 'dired-goto-subdir) -(define-key dired-mode-map "F" 'dired-do-find-marked-files) -(define-key dired-mode-map "Y" 'dired-do-relsymlink) -(define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp) -(define-key dired-mode-map "V" 'dired-do-run-mail) - -(if dired-bind-man - (define-key dired-mode-map "N" 'dired-man)) - -(if dired-bind-info - (define-key dired-mode-map "I" 'dired-info)) - -;;; MENU BINDINGS - -(let ((menu-bar (lookup-key dired-mode-map [menu-bar]))) - (let ((menu (lookup-key menu-bar [operate]))) - (define-key-after - menu - [find-files] - '(menu-item - "Find files" - dired-do-find-marked-files - :help "Find current or marked files") - 'delete) - (define-key-after - menu - [relsymlink] - '(menu-item - "Relative symlink to..." - dired-do-relsymlink - :visible (fboundp 'make-symbolic-link) - :help "Make relative symbolic links for current or marked files") - 'symlink)) - (let ((menu (lookup-key menu-bar [mark]))) - (define-key-after - menu - [flag-extension] - '(menu-item - "Flag extension..." - dired-flag-extension - :help "Flag files with a certain extension for deletion") - 'garbage-files) - (define-key-after - menu - [mark-extension] - '(menu-item - "Mark extension..." - dired-mark-extension - :help "Mark files with a certain extension") - 'symlinks) - (define-key-after - menu - [mark-omitted] - '(menu-item - "Mark omitted" - dired-mark-omitted - :help "Mark files matching `dired-omit-files' and `dired-omit-extensions'") - 'mark-extension)) - (let ((menu (lookup-key menu-bar [regexp]))) - (define-key-after - menu - [relsymlink-regexp] - '(menu-item - "Relative symlink..." - dired-do-relsymlink-regexp - :visible (fboundp 'make-symbolic-link) - :help "Make relative symbolic links for files matching regexp") - 'symlink)) - (let ((menu (lookup-key menu-bar [immediate]))) - (define-key-after - menu - [omit-mode] - '(menu-item - "Omit mode" dired-omit-mode - :button (:toggle . dired-omit-mode) - :help "Enable or disable omitting \"uninteresting\" files") - 'dashes))) - -;;; GLOBAL BINDING. -(if dired-bind-jump - (progn - (define-key global-map "\C-x\C-j" 'dired-jump) - (define-key global-map "\C-x4\C-j" 'dired-jump-other-window))) - - -;; Install into appropriate hooks. - -(add-hook 'dired-mode-hook 'dired-extra-startup) -(add-hook 'dired-after-readin-hook 'dired-omit-expunge) - -(defun dired-extra-startup () - "Automatically put on `dired-mode-hook' to get extra Dired features: -\\ - \\[dired-do-run-mail]\t-- run mail on folder (see `dired-bind-vm') - \\[dired-info]\t-- run info on file - \\[dired-man]\t-- run man on file - \\[dired-do-find-marked-files]\t-- visit all marked files simultaneously - \\[dired-omit-mode]\t-- toggle omitting of files - \\[dired-mark-sexp]\t-- mark by Lisp expression - \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring; - \t you can feed it to other commands using \\[yank] - -For more features, see variables - - `dired-bind-vm' - `dired-bind-jump' - `dired-bind-info' - `dired-bind-man' - `dired-vm-read-only-folders' - `dired-omit-mode' - `dired-omit-files' - `dired-omit-extensions' - `dired-omit-size-limit' - `dired-find-subdir' - `dired-enable-local-variables' - `dired-local-variables-file' - `dired-guess-shell-gnutar' - `dired-guess-shell-gzip-quiet' - `dired-guess-shell-znew-switches' - `dired-guess-shell-alist-user' - `dired-clean-up-buffers-too' - -See also functions - - `dired-flag-extension' - `dired-virtual' - `dired-jump' - `dired-man' - `dired-vm' - `dired-rmail' - `dired-info' - `dired-do-find-marked-files'" - (interactive) - - ;; These must be done in each new dired buffer. - (dired-hack-local-variables) - (dired-omit-startup)) - - -;;; BUFFER CLEANING. - -;; REDEFINE. -(defun dired-clean-up-after-deletion (fn) - "Clean up after a deleted file or directory FN. -Remove expanded subdir of deleted dir, if any." - (save-excursion (and (cdr dired-subdir-alist) - (dired-goto-subdir fn) - (dired-kill-subdir))) - - ;; Offer to kill buffer of deleted file FN. - (if dired-clean-up-buffers-too - (progn - (let ((buf (get-file-buffer fn))) - (and buf - (funcall (function y-or-n-p) - (format "Kill buffer of %s, too? " - (file-name-nondirectory fn))) - (save-excursion ; you never know where kill-buffer leaves you - (kill-buffer buf)))) - (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))) - (buf nil)) - (and buf-list - (y-or-n-p (format "Kill dired buffer%s of %s, too? " - (dired-plural-s (length buf-list)) - (file-name-nondirectory fn))) - (while buf-list - (save-excursion (kill-buffer (car buf-list))) - (setq buf-list (cdr buf-list))))))) - ;; Anything else? - ) - - -;;; EXTENSION MARKING FUNCTIONS. - -;; Mark files with some extension. -(defun dired-mark-extension (extension &optional marker-char) - "Mark all files with a certain EXTENSION for use in later commands. -A `.' is *not* automatically prepended to the string entered." - ;; EXTENSION may also be a list of extensions instead of a single one. - ;; Optional MARKER-CHAR is marker to use. - (interactive "sMarking extension: \nP") - (or (listp extension) - (setq extension (list extension))) - (dired-mark-files-regexp - (concat ".";; don't match names with nothing but an extension - "\\(" - (mapconcat 'regexp-quote extension "\\|") - "\\)$") - marker-char)) - -(defun dired-flag-extension (extension) - "In dired, flag all files with a certain EXTENSION for deletion. -A `.' is *not* automatically prepended to the string entered." - (interactive "sFlagging extension: ") - (dired-mark-extension extension dired-del-marker)) - -;; Define some unpopular file extensions. Used for cleaning and omitting. - -(defvar dired-patch-unclean-extensions - '(".rej" ".orig") - "List of extensions of dispensable files created by the `patch' program.") - -(defvar dired-tex-unclean-extensions - '(".toc" ".log" ".aux");; these are already in completion-ignored-extensions - "List of extensions of dispensable files created by TeX.") - -(defvar dired-latex-unclean-extensions - '(".idx" ".lof" ".lot" ".glo") - "List of extensions of dispensable files created by LaTeX.") - -(defvar dired-bibtex-unclean-extensions - '(".blg" ".bbl") - "List of extensions of dispensable files created by BibTeX.") - -(defvar dired-texinfo-unclean-extensions - '(".cp" ".cps" ".fn" ".fns" ".ky" ".kys" ".pg" ".pgs" - ".tp" ".tps" ".vr" ".vrs") - "List of extensions of dispensable files created by texinfo.") - -(defun dired-clean-patch () - "Flag dispensable files created by patch for deletion. -See variable `dired-patch-unclean-extensions'." - (interactive) - (dired-flag-extension dired-patch-unclean-extensions)) - -(defun dired-clean-tex () - "Flag dispensable files created by [La]TeX etc. for deletion. -See variables `dired-tex-unclean-extensions', -`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and -`dired-texinfo-unclean-extensions'." - (interactive) - (dired-flag-extension (append dired-texinfo-unclean-extensions - dired-latex-unclean-extensions - dired-bibtex-unclean-extensions - dired-tex-unclean-extensions))) - -(defun dired-very-clean-tex () - "Flag dispensable files created by [La]TeX *and* \".dvi\" for deletion. -See variables `dired-texinfo-unclean-extensions', -`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and -`dired-texinfo-unclean-extensions'." - (interactive) - (dired-flag-extension (append dired-texinfo-unclean-extensions - dired-latex-unclean-extensions - dired-bibtex-unclean-extensions - dired-tex-unclean-extensions - (list ".dvi")))) - -;;; JUMP. - -;;;###autoload -(defun dired-jump (&optional other-window) - "Jump to dired buffer corresponding to current buffer. -If in a file, dired the current directory and move to file's line. -If in Dired already, pop up a level and goto old directory's line. -In case the proper dired file line cannot be found, refresh the dired -buffer and try again." - (interactive "P") - (let* ((file buffer-file-name) - (dir (if file (file-name-directory file) default-directory))) - (if (eq major-mode 'dired-mode) - (progn - (setq dir (dired-current-directory)) - (dired-up-directory other-window) - (or (dired-goto-file dir) - ;; refresh and try again - (progn - (dired-insert-subdir (file-name-directory dir)) - (dired-goto-file dir)))) - (if other-window - (dired-other-window dir) - (dired dir)) - (if file - (or (dired-goto-file file) - ;; refresh and try again - (progn - (dired-insert-subdir (file-name-directory file)) - (dired-goto-file file)) - ;; Toggle omitting, if it is on, and try again. - (if dired-omit-mode - (progn - (dired-omit-mode) - (dired-goto-file file)))))))) - -(defun dired-jump-other-window () - "Like \\[dired-jump] (`dired-jump') but in other window." - (interactive) - (dired-jump t)) - -;;; OMITTING. - -;; Enhanced omitting of lines from directory listings. -;; Marked files are never omitted. - -;; should probably get rid of this and always use 'no-dir. -;; sk 28-Aug-1991 09:37 -(defvar dired-omit-localp 'no-dir - "The LOCALP argument `dired-omit-expunge' passes to `dired-get-filename'. -If it is `no-dir', omitting is much faster, but you can only match -against the non-directory part of the file name. Set it to nil if you -need to match the entire file name.") - -;; \017=^O for Omit - other packages can chose other control characters. -(defvar dired-omit-marker-char ?\017 - "Temporary marker used by dired-omit. -Should never be used as marker by the user or other packages.") - -(defun dired-omit-startup () - (or (assq 'dired-omit-mode minor-mode-alist) - (setq minor-mode-alist - (append '((dired-omit-mode - (:eval (if (eq major-mode 'dired-mode) - " Omit" "")))) - minor-mode-alist)))) - -(defun dired-mark-omitted () - "Mark files matching `dired-omit-files' and `dired-omit-extensions'." - (interactive) - (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files - (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp)) - -(defvar dired-omit-extensions - (append completion-ignored-extensions - dired-latex-unclean-extensions - dired-bibtex-unclean-extensions - dired-texinfo-unclean-extensions) - "If non-nil, a list of extensions \(strings\) to omit from Dired listings. -Defaults to elements of `completion-ignored-extensions', -`dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions', and -`dired-texinfo-unclean-extensions'. - -See interactive function `dired-omit-mode' \(\\[dired-omit-mode]\) and -variables `dired-omit-mode' and `dired-omit-files'.") - -(defun dired-omit-expunge (&optional regexp) - "Erases all unmarked files matching REGEXP. -Does nothing if global variable `dired-omit-mode' is nil, or if called - non-interactively and buffer is bigger than `dired-omit-size-limit'. -If REGEXP is nil or not specified, uses `dired-omit-files', and also omits - filenames ending in `dired-omit-extensions'. -If REGEXP is the empty string, this function is a no-op. - -This functions works by temporarily binding `dired-marker-char' to -`dired-omit-marker-char' and calling `dired-do-kill-lines'." - (interactive "sOmit files (regexp): ") - (if (and dired-omit-mode - (or (interactive-p) - (not dired-omit-size-limit) - (< (buffer-size) dired-omit-size-limit) - (progn - (message "Not omitting: directory larger than %d characters." - dired-omit-size-limit) - (setq dired-omit-mode nil) - nil))) - (let ((omit-re (or regexp (dired-omit-regexp))) - (old-modified-p (buffer-modified-p)) - count) - (or (string= omit-re "") - (let ((dired-marker-char dired-omit-marker-char)) - (message "Omitting...") - (if (dired-mark-unmarked-files omit-re nil nil dired-omit-localp) - (progn - (setq count (dired-do-kill-lines nil "Omitted %d line%s.")) - (force-mode-line-update)) - (message "(Nothing to omit)")))) - ;; Try to preserve modified state of buffer. So `%*' doesn't appear - ;; in mode-line of omitted buffers. - (set-buffer-modified-p (and old-modified-p - (save-excursion - (goto-char (point-min)) - (re-search-forward dired-re-mark nil t)))) - count))) - -(defun dired-omit-regexp () - (concat (if dired-omit-files (concat "\\(" dired-omit-files "\\)") "") - (if (and dired-omit-files dired-omit-extensions) "\\|" "") - (if dired-omit-extensions - (concat ".";; a non-extension part should exist - "\\(" - (mapconcat 'regexp-quote dired-omit-extensions "\\|") - "\\)$") - ""))) - -;; Returns t if any work was done, nil otherwise. -(defun dired-mark-unmarked-files (regexp msg &optional unflag-p localp) - "Mark unmarked files matching REGEXP, displaying MSG. -REGEXP is matched against the entire file name. -Does not re-mark files which already have a mark. -With prefix argument, unflag all those files. -Optional fourth argument LOCALP is as in `dired-get-filename'." - (interactive "P") - (let ((dired-marker-char (if unflag-p ?\s dired-marker-char))) - (dired-mark-if - (and - ;; not already marked - (looking-at " ") - ;; uninteresting - (let ((fn (dired-get-filename localp t))) - (and fn (string-match regexp fn)))) - msg))) - -;; Compiler does not get fset. -(declare-function dired-omit-old-add-entry "dired-x") - -;; REDEFINE. -;; Redefine dired-aux.el's version of `dired-add-entry' -;; Save old defun if not already done: -(or (fboundp 'dired-omit-old-add-entry) - (fset 'dired-omit-old-add-entry (symbol-function 'dired-add-entry))) - -;; REDEFINE. -(defun dired-omit-new-add-entry (filename &optional marker-char relative) - ;; This redefines dired-aux.el's dired-add-entry to avoid calling ls for - ;; files that are going to be omitted anyway. - (if dired-omit-mode - ;; perhaps return t without calling ls - (let ((omit-re (dired-omit-regexp))) - (if (or (string= omit-re "") - (not - (string-match omit-re - (cond - ((eq 'no-dir dired-omit-localp) - filename) - ((eq t dired-omit-localp) - (dired-make-relative filename)) - (t - (dired-make-absolute - filename - (file-name-directory filename))))))) - ;; if it didn't match, go ahead and add the entry - (dired-omit-old-add-entry filename marker-char relative) - ;; dired-add-entry returns t for success, perhaps we should - ;; return file-exists-p - t)) - ;; omitting is not turned on at all - (dired-omit-old-add-entry filename marker-char relative))) - -;; Redefine it. -(fset 'dired-add-entry 'dired-omit-new-add-entry) - - -;;; VIRTUAL DIRED MODE. - -;; For browsing `ls -lR' listings in a dired-like fashion. - -(defalias 'virtual-dired 'dired-virtual) -(defun dired-virtual (dirname &optional switches) - "Put this buffer into Virtual Dired mode. - -In Virtual Dired mode, all commands that do not actually consult the -filesystem will work. - -This is useful if you want to peruse and move around in an ls -lR -output file, for example one you got from an ftp server. With -ange-ftp, you can even dired a directory containing an ls-lR file, -visit that file and turn on virtual dired mode. But don't try to save -this file, as dired-virtual indents the listing and thus changes the -buffer. - -If you have save a Dired buffer in a file you can use \\[dired-virtual] to -resume it in a later session. - -Type \\\\[revert-buffer] \ -in the Virtual Dired buffer and answer `y' to convert -the virtual to a real dired buffer again. You don't have to do this, though: -you can relist single subdirs using \\[dired-do-redisplay]." - - ;; DIRNAME is the top level directory of the buffer. It will become - ;; its `default-directory'. If nil, the old value of - ;; default-directory is used. - - ;; Optional SWITCHES are the ls switches to use. - - ;; Shell wildcards will be used if there already is a `wildcard' - ;; line in the buffer (thus it is a saved Dired buffer), but there - ;; is no other way to get wildcards. Insert a `wildcard' line by - ;; hand if you want them. - - (interactive - (list (read-string "Virtual Dired directory: " (dired-virtual-guess-dir)))) - (goto-char (point-min)) - (or (looking-at " ") - ;; if not already indented, do it now: - (indent-region (point-min) (point-max) 2)) - (or dirname (setq dirname default-directory)) - (setq dirname (expand-file-name (file-name-as-directory dirname))) - (setq default-directory dirname) ; contains no wildcards - (let ((wildcard (save-excursion - (goto-char (point-min)) - (forward-line 1) - (and (looking-at "^ wildcard ") - (buffer-substring (match-end 0) - (progn (end-of-line) (point))))))) - (if wildcard - (setq dirname (expand-file-name wildcard default-directory)))) - ;; If raw ls listing (not a saved old dired buffer), give it a - ;; decent subdir headerline: - (goto-char (point-min)) - (or (looking-at dired-subdir-regexp) - (insert " " - (directory-file-name (file-name-directory default-directory)) - ":\n")) - (dired-mode dirname (or switches dired-listing-switches)) - (setq mode-name "Virtual Dired" - revert-buffer-function 'dired-virtual-revert) - (set (make-local-variable 'dired-subdir-alist) nil) - (dired-build-subdir-alist) - (goto-char (point-min)) - (dired-initial-position dirname)) - -(defun dired-virtual-guess-dir () - "Guess and return appropriate working directory of this buffer. -The buffer is assumed to be in Dired or ls -lR format. The guess is -based upon buffer contents. If nothing could be guessed, returns -nil." - - (let ((regexp "^\\( \\)?\\([^ \n\r]*\\)\\(:\\)[\n\r]") - (subexpr 2)) - (goto-char (point-min)) - (cond ((looking-at regexp) - ;; If a saved dired buffer, look to which dir and - ;; perhaps wildcard it belongs: - (let ((dir (buffer-substring (match-beginning subexpr) - (match-end subexpr)))) - (file-name-as-directory dir))) - ;; Else no match for headerline found. It's a raw ls listing. - ;; In raw ls listings the directory does not have a headerline - ;; try parent of first subdir, if any - ((re-search-forward regexp nil t) - (file-name-directory - (directory-file-name - (file-name-as-directory - (buffer-substring (match-beginning subexpr) - (match-end subexpr)))))) - (t ; if all else fails - nil)))) - - -(defun dired-virtual-revert (&optional arg noconfirm) - (if (not - (y-or-n-p "Cannot revert a Virtual Dired buffer - switch to Real Dired mode? ")) - (error "Cannot revert a Virtual Dired buffer") - (setq mode-name "Dired" - revert-buffer-function 'dired-revert) - (revert-buffer))) - -;; A zero-arg version of dired-virtual. -(defun dired-virtual-mode () - "Put current buffer into Virtual Dired mode (see `dired-virtual'). -Useful on `magic-mode-alist' with the regexp - - \"^ \\\\(/[^ /]+\\\\)+/?:$\" - -to put saved dired buffers automatically into Virtual Dired mode. - -Also useful for `auto-mode-alist' like this: - - (add-to-list 'auto-mode-alist - '(\"[^/]\\\\.dired\\\\'\" . dired-virtual-mode))" - (interactive) - (dired-virtual (dired-virtual-guess-dir))) - - -;;; SMART SHELL. - -;; An Emacs buffer can have but one working directory, stored in the -;; buffer-local variable `default-directory'. A Dired buffer may have -;; several subdirectories inserted, but still has but one working directory: -;; that of the top level Dired directory in that buffer. For some commands -;; it is appropriate that they use the current Dired directory instead of -;; `default-directory', e.g., `find-file' and `compile'. This is a general -;; mechanism is provided for special handling of the working directory in -;; special major modes. - -;; It's easier to add to this alist than redefine function -;; default-directory while keeping the old information. -(defconst default-directory-alist - '((dired-mode . (if (fboundp 'dired-current-directory) - (dired-current-directory) - default-directory))) - "Alist of major modes and their opinion on `default-directory'. -This is given as a Lisp expression to evaluate. A resulting value of -nil is ignored in favor of `default-directory'.") - -(defun dired-default-directory () - "Usage like variable `default-directory'. -Knows about the special cases in variable `default-directory-alist'." - (or (eval (cdr (assq major-mode default-directory-alist))) - default-directory)) - -(defun dired-smart-shell-command (command &optional output-buffer error-buffer) - "Like function `shell-command', but in the current Virtual Dired directory." - (interactive - (list - (read-shell-command "Shell command: " nil nil - (cond - (buffer-file-name (file-relative-name buffer-file-name)) - ((eq major-mode 'dired-mode) (dired-get-filename t t)))) - current-prefix-arg - shell-command-default-error-buffer)) - (let ((default-directory (dired-default-directory))) - (shell-command command output-buffer error-buffer))) - - -;;; LOCAL VARIABLES FOR DIRED BUFFERS. - -;; Brief Description: -;;; -;; * `dired-extra-startup' is part of the `dired-mode-hook'. -;;; -;; * `dired-extra-startup' calls `dired-hack-local-variables' -;;; -;; * `dired-hack-local-variables' checks the value of -;;; `dired-local-variables-file' -;;; -;; * Check if `dired-local-variables-file' is a non-nil string and is a -;;; filename found in the directory of the Dired Buffer being created. -;;; -;; * If `dired-local-variables-file' satisfies the above, then temporarily -;;; include it in the Dired Buffer at the bottom. -;;; -;; * Set `enable-local-variables' temporarily to the user variable -;;; `dired-enable-local-variables' and run `hack-local-variables' on the -;;; Dired Buffer. - -(defvar dired-local-variables-file (convert-standard-filename ".dired") - "Filename, as string, containing local dired buffer variables to be hacked. -If this file found in current directory, then it will be inserted into dired -buffer and `hack-local-variables' will be run. See Info node -`(emacs)File Variables' for more information on local variables. -See also `dired-enable-local-variables'.") - -(defun dired-hack-local-variables () - "Evaluate local variables in `dired-local-variables-file' for dired buffer." - (if (and dired-local-variables-file - (stringp dired-local-variables-file) - (file-exists-p dired-local-variables-file)) - (let ((opoint (point-max)) - buffer-read-only - ;; In case user has `enable-local-variables' set to nil we - ;; override it locally with dired's variable. - (enable-local-variables dired-enable-local-variables)) - ;; Insert 'em. - (save-excursion - (goto-char opoint) - (insert "\^L\n") - (insert-file-contents dired-local-variables-file)) - ;; Hack 'em. - (let ((buffer-file-name dired-local-variables-file)) - (hack-local-variables)) - ;; Make sure that the modeline shows the proper information. - (dired-sort-set-modeline) - ;; Delete this stuff: `eobp' is used to find last subdir by dired.el. - (delete-region opoint (point-max))))) - -(defun dired-omit-here-always () - "Create `dired-local-variables-file' for omitting and reverts directory. -Sets `dired-omit-mode' to t in a local variables file that is readable by -dired." - (interactive) - (if (file-exists-p dired-local-variables-file) - (message "File `./%s' already exists." dired-local-variables-file) - - ;; Create `dired-local-variables-file'. - (with-current-buffer (get-buffer-create " *dot-dired*") - (erase-buffer) - (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n") - (write-file dired-local-variables-file) - (kill-buffer (current-buffer))) - - ;; Run extra-hooks and revert directory. - (dired-extra-startup) - (dired-revert))) - - -;;; GUESS SHELL COMMAND. - -;; Brief Description: -;;; -;; `dired-do-shell-command' is bound to `!' by dired.el. -;;; -;; * Redefine `dired-read-shell-command' so it calls -;;; `dired-guess-shell-command'. -;;; -;; * `dired-guess-shell-command' calls `dired-guess-default' with list of -;;; marked files. -;;; -;; * Parse `dired-guess-shell-alist-user' and -;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP -;;; that matches the first file in the file list. -;;; -;; * If the REGEXP matches all the entries of the file list then evaluate -;;; COMMAND, which is either a string or a Lisp expression returning a -;;; string. COMMAND may be a list of commands. -;;; -;; * Return this command to `dired-guess-shell-command' which prompts user -;;; with it. The list of commands is put into the list of default values. -;;; If a command is used successfully then it is stored permanently in -;;; `dired-shell-command-history'. - -;; Guess what shell command to apply to a file. -(defvar dired-shell-command-history nil - "History list for commands that read dired-shell commands.") - -;; Default list of shell commands. - -;; NOTE: Use `gunzip -c' instead of `zcat' on `.gz' files. Some do not -;; install GNU zip's version of zcat. - -(defvar dired-guess-shell-alist-default - (list - (list "\\.tar$" - '(if dired-guess-shell-gnutar - (concat dired-guess-shell-gnutar " xvf") - "tar xvf") - ;; Extract files into a separate subdirectory - '(if dired-guess-shell-gnutar - (concat "mkdir " (file-name-sans-extension file) - "; " dired-guess-shell-gnutar " -C " - (file-name-sans-extension file) " -xvf") - (concat "mkdir " (file-name-sans-extension file) - "; tar -C " (file-name-sans-extension file) " -xvf")) - ;; List archive contents. - '(if dired-guess-shell-gnutar - (concat dired-guess-shell-gnutar " tvf") - "tar tvf")) - - ;; REGEXPS for compressed archives must come before the .Z rule to - ;; be recognized: - (list "\\.tar\\.Z$" - ;; Untar it. - '(if dired-guess-shell-gnutar - (concat dired-guess-shell-gnutar " zxvf") - (concat "zcat * | tar xvf -")) - ;; Optional conversion to gzip format. - '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") - " " dired-guess-shell-znew-switches)) - - ;; gzip'ed archives - (list "\\.t\\(ar\\.\\)?gz$" - '(if dired-guess-shell-gnutar - (concat dired-guess-shell-gnutar " zxvf") - (concat "gunzip -qc * | tar xvf -")) - ;; Extract files into a separate subdirectory - '(if dired-guess-shell-gnutar - (concat "mkdir " (file-name-sans-extension file) - "; " dired-guess-shell-gnutar " -C " - (file-name-sans-extension file) " -zxvf") - (concat "mkdir " (file-name-sans-extension file) - "; gunzip -qc * | tar -C " - (file-name-sans-extension file) " -xvf -")) - ;; Optional decompression. - '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q" "")) - ;; List archive contents. - '(if dired-guess-shell-gnutar - (concat dired-guess-shell-gnutar " ztvf") - (concat "gunzip -qc * | tar tvf -"))) - - ;; bzip2'ed archives - (list "\\.t\\(ar\\.bz2\\|bz\\)$" - "bunzip2 -c * | tar xvf -" - ;; Extract files into a separate subdirectory - '(concat "mkdir " (file-name-sans-extension file) - "; bunzip2 -c * | tar -C " - (file-name-sans-extension file) " -xvf -") - ;; Optional decompression. - "bunzip2") - - '("\\.shar\\.Z$" "zcat * | unshar") - '("\\.shar\\.g?z$" "gunzip -qc * | unshar") - - '("\\.e?ps$" "ghostview" "xloadimage" "lpr") - (list "\\.e?ps\\.g?z$" "gunzip -qc * | ghostview -" - ;; Optional decompression. - '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) - (list "\\.e?ps\\.Z$" "zcat * | ghostview -" - ;; Optional conversion to gzip format. - '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") - " " dired-guess-shell-znew-switches)) - - '("\\.patch$" "cat * | patch") - (list "\\.patch\\.g?z$" "gunzip -qc * | patch" - ;; Optional decompression. - '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) - (list "\\.patch\\.Z$" "zcat * | patch" - ;; Optional conversion to gzip format. - '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") - " " dired-guess-shell-znew-switches)) - - ;; The following four extensions are useful with dired-man ("N" key) - (list "\\.\\(?:[0-9]\\|man\\)$" '(progn (require 'man) - (if (Man-support-local-filenames) - "man -l" - "cat * | tbl | nroff -man -h"))) - (list "\\.\\(?:[0-9]\\|man\\)\\.g?z$" '(progn (require 'man) - (if (Man-support-local-filenames) - "man -l" - "gunzip -qc * | tbl | nroff -man -h")) - ;; Optional decompression. - '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) - (list "\\.[0-9]\\.Z$" '(progn (require 'man) - (if (Man-support-local-filenames) - "man -l" - "zcat * | tbl | nroff -man -h")) - ;; Optional conversion to gzip format. - '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") - " " dired-guess-shell-znew-switches)) - '("\\.pod$" "perldoc" "pod2man * | nroff -man") - - '("\\.dvi$" "xdvi" "dvips") ; preview and printing - '("\\.au$" "play") ; play Sun audiofiles - '("\\.mpe?g$\\|\\.avi$" "xine -p") - '("\\.ogg$" "ogg123") - '("\\.mp3$" "mpg123") - '("\\.wav$" "play") - '("\\.uu$" "uudecode") ; for uudecoded files - '("\\.hqx$" "mcvert") - '("\\.sh$" "sh") ; execute shell scripts - '("\\.xbm$" "bitmap") ; view X11 bitmaps - '("\\.gp$" "gnuplot") - '("\\.p[bgpn]m$" "xloadimage") - '("\\.gif$" "xloadimage") ; view gif pictures - '("\\.tif$" "xloadimage") - '("\\.png$" "display") ; xloadimage 4.1 doesn't grok PNG - '("\\.jpe?g$" "xloadimage") - '("\\.fig$" "xfig") ; edit fig pictures - '("\\.out$" "xgraph") ; for plotting purposes. - '("\\.tex$" "latex" "tex") - '("\\.texi\\(nfo\\)?$" "makeinfo" "texi2dvi") - '("\\.pdf$" "xpdf") - '("\\.doc$" "antiword" "strings") - '("\\.rpm$" "rpm -qilp" "rpm -ivh") - '("\\.dia$" "dia") - '("\\.mgp$" "mgp") - - ;; Some other popular archivers. - (list "\\.zip$" "unzip" "unzip -l" - ;; Extract files into a separate subdirectory - '(concat "unzip" (if dired-guess-shell-gzip-quiet " -q") - " -d " (file-name-sans-extension file))) - '("\\.zoo$" "zoo x//") - '("\\.lzh$" "lharc x") - '("\\.arc$" "arc x") - '("\\.shar$" "unshar") - - ;; Compression. - (list "\\.g?z$" '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) - (list "\\.dz$" "dictunzip") - (list "\\.bz2$" "bunzip2") - (list "\\.Z$" "uncompress" - ;; Optional conversion to gzip format. - '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") - " " dired-guess-shell-znew-switches)) - - '("\\.sign?$" "gpg --verify")) - - "Default alist used for shell command guessing. -See `dired-guess-shell-alist-user'.") - -(defcustom dired-guess-shell-alist-user nil - "User-defined alist of rules for suggested commands. -These rules take precedence over the predefined rules in the variable -`dired-guess-shell-alist-default' (to which they are prepended). - -Each element of this list looks like - - \(REGEXP COMMAND...\) - -where each COMMAND can either be a string or a Lisp expression that evaluates -to a string. If several COMMANDs are given, the first one will be the default -and the rest will be added temporarily to the history and can be retrieved -with \\[previous-history-element] (M-p) . - -The variable `dired-guess-shell-case-fold-search' controls whether -REGEXP is matched case-sensitively. - -You can set this variable in your ~/.emacs. For example, to add rules for -`.foo' and `.bar' files, write - - \(setq dired-guess-shell-alist-user - (list (list \"\\\\.foo\\\\'\" \"FOO-COMMAND\");; fixed rule - ;; possibly more rules ... - (list \"\\\\.bar\\\\'\";; rule with condition test - '(if condition - \"BAR-COMMAND-1\" - \"BAR-COMMAND-2\")))\)" - :group 'dired-x - :type '(alist :key-type regexp :value-type (repeat sexp))) - -(defcustom dired-guess-shell-case-fold-search t - "If non-nil, `dired-guess-shell-alist-default' and -`dired-guess-shell-alist-user' are matched case-insensitively." - :group 'dired-x - :type 'boolean) - -(defun dired-guess-default (files) - "Guess a shell commands for FILES. Return command or list of commands. -See `dired-guess-shell-alist-user'." - - (let* ((case-fold-search dired-guess-shell-case-fold-search) - ;; Prepend the user's alist to the default alist. - (alist (append dired-guess-shell-alist-user - dired-guess-shell-alist-default)) - (file (car files)) - (flist (cdr files)) - elt regexp cmds) - - ;; Find the first match in the alist for first file in FILES. - (while alist - (setq elt (car alist) - regexp (car elt) - alist (cdr alist)) - (if (string-match regexp file) - (setq cmds (cdr elt) - alist nil))) - - ;; If more than one file, see if all of FILES match regular expression. - (while (and flist - (string-match regexp (car flist))) - (setq flist (cdr flist))) - - ;; If flist is still non-nil, then do not guess since this means that not - ;; all the files in FILES were matched by the regexp. - (setq cmds (and (not flist) cmds)) - - ;; Return commands or nil if flist is still non-nil. - ;; Evaluate the commands in order that any logical testing will be done. - (cond ((not (cdr cmds)) - (eval (car cmds))) ; single command - (t - (mapcar (function eval) cmds))))) - -(defun dired-guess-shell-command (prompt files) - "Ask user with PROMPT for a shell command, guessing a default from FILES." - (let ((default (dired-guess-default files)) - default-list val) - (if (null default) - ;; Nothing to guess - (read-shell-command prompt nil 'dired-shell-command-history) - (if (listp default) - ;; More than one guess - (setq default-list default - default (car default) - prompt (concat - prompt - (format "{%d guesses} " (length default-list)))) - ;; Just one guess - (setq default-list (list default))) - ;; Put the first guess in the prompt but not in the initial value. - (setq prompt (concat prompt (format "[%s] " default))) - ;; All guesses can be retrieved with M-n - (setq val (read-shell-command prompt nil - 'dired-shell-command-history - default-list)) - ;; If we got a return, then return default. - (if (equal val "") default val)))) - -;; REDEFINE. -;; Redefine dired-aux.el's version: -(defun dired-read-shell-command (prompt arg files) - "Read a dired shell command prompting with PROMPT (using read-shell-command). -ARG is the prefix arg and may be used to indicate in the prompt which -FILES are affected. -This is an extra function so that you can redefine it." - (minibuffer-with-setup-hook - (lambda () - (set (make-local-variable 'minibuffer-default-add-function) - 'minibuffer-default-add-dired-shell-commands)) - (dired-mark-pop-up - nil 'shell files - 'dired-guess-shell-command - (format prompt (dired-mark-prompt arg files)) ; PROMPT - files))) ; FILES - - -;;; RELATIVE SYMBOLIC LINKS. - -(declare-function make-symbolic-link "fileio.c") - -(defvar dired-keep-marker-relsymlink ?S - "See variable `dired-keep-marker-move'.") - -(defun dired-make-relative-symlink (file1 file2 &optional ok-if-already-exists) - "Make a symbolic link (pointing to FILE1) in FILE2. -The link is relative (if possible), for example - - \"/vol/tex/bin/foo\" \"/vol/local/bin/foo\" - -results in - - \"../../tex/bin/foo\" \"/vol/local/bin/foo\"" - (interactive "FRelSymLink: \nFRelSymLink %s: \np") - (let (name1 name2 len1 len2 (index 0) sub) - (setq file1 (expand-file-name file1) - file2 (expand-file-name file2) - len1 (length file1) - len2 (length file2)) - ;; Find common initial file name components: - (let (next) - (while (and (setq next (string-match "/" file1 index)) - (setq next (1+ next)) - (< next (min len1 len2)) - ;; For the comparison, both substrings must end in - ;; `/', so NEXT is *one plus* the result of the - ;; string-match. - ;; E.g., consider the case of linking "/tmp/a/abc" - ;; to "/tmp/abc" erroneously giving "/tmp/a" instead - ;; of "/tmp/" as common initial component - (string-equal (substring file1 0 next) - (substring file2 0 next))) - (setq index next)) - (setq name2 file2 - sub (substring file1 0 index) - name1 (substring file1 index))) - (if (string-equal sub "/") - ;; No common initial file name found - (setq name1 file1) - ;; Else they have a common parent directory - (let ((tem (substring file2 index)) - (start 0) - (count 0)) - ;; Count number of slashes we must compensate for ... - (while (setq start (string-match "/" tem start)) - (setq count (1+ count) - start (1+ start))) - ;; ... and prepend a "../" for each slash found: - (while (> count 0) - (setq count (1- count) - name1 (concat "../" name1))))) - (make-symbolic-link - (directory-file-name name1) ; must not link to foo/ - ; (trailing slash!) - name2 ok-if-already-exists))) - -;;;###autoload -(defun dired-do-relsymlink (&optional arg) - "Relative symlink all marked (or next ARG) files into a directory. -Otherwise make a relative symbolic link to the current file. -This creates relative symbolic links like - - foo -> ../bar/foo - -not absolute ones like - - foo -> /ugly/file/name/that/may/change/any/day/bar/foo - -For absolute symlinks, use \\[dired-do-symlink]." - (interactive "P") - (dired-do-create-files 'relsymlink (function dired-make-relative-symlink) - "RelSymLink" arg dired-keep-marker-relsymlink)) - -(defun dired-do-relsymlink-regexp (regexp newname &optional arg whole-name) - "RelSymlink all marked files containing REGEXP to NEWNAME. -See functions `dired-do-rename-regexp' and `dired-do-relsymlink' -for more info." - (interactive (dired-mark-read-regexp "RelSymLink")) - (dired-do-create-files-regexp - (function dired-make-relative-symlink) - "RelSymLink" arg regexp newname whole-name dired-keep-marker-relsymlink)) - - -;;; VISIT ALL MARKED FILES SIMULTANEOUSLY. - -;; Brief Description: -;;; -;; `dired-do-find-marked-files' is bound to `F' by dired-x.el. -;;; -;; * Use `dired-get-marked-files' to collect the marked files in the current -;;; Dired Buffer into a list of filenames `FILE-LIST'. -;;; -;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with -;;; `dired-do-find-marked-files''s prefix argument NOSELECT. -;;; -;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the -;;; list each time. -;;; -;; * If NOSELECT is non-nil then just run `find-file-noselect' on each -;;; element of FILE-LIST. -;;; -;; * If NOSELECT is nil then calculate the `size' of the window for each file -;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is -;;; cognizant of the window-configuration. -;;; -;; * If `size' is too small abort, otherwise run `find-file' on each element -;;; of FILE-LIST giving each a window of height `size'. - -(defun dired-do-find-marked-files (&optional noselect) - "Find all marked files displaying all of them simultaneously. -With optional NOSELECT just find files but do not select them. - -The current window is split across all files marked, as evenly as possible. -Remaining lines go to bottom-most window. The number of files that can be -displayed this way is restricted by the height of the current window and -`window-min-height'. - -To keep dired buffer displayed, type \\[split-window-vertically] first. -To display just marked files, type \\[delete-other-windows] first." - - (interactive "P") - (dired-simultaneous-find-file (dired-get-marked-files) noselect)) - -(defun dired-simultaneous-find-file (file-list noselect) - - "Visit all files in FILE-LIST and display them simultaneously. -The current window is split across all files in FILE-LIST, as evenly as -possible. Remaining lines go to the bottom-most window. The number of -files that can be displayed this way is restricted by the height of the -current window and the variable `window-min-height'. With non-nil -NOSELECT the files are merely found but not selected." - - ;; We don't make this function interactive because it is usually too clumsy - ;; to specify FILE-LIST interactively unless via dired. - - (let (size) - - (if noselect - ;; Do not select the buffer. - (find-file-noselect (car file-list)) - - ;; We will have to select the buffer. Calculate and check window size. - (setq size (/ (window-height) (length file-list))) - (or (<= window-min-height size) - (error "Too many files to visit simultaneously. Try C-u prefix")) - (find-file (car file-list))) - - ;; Decrement. - (setq file-list (cdr file-list)) - - (while file-list - - (if noselect - ;; Do not select the buffer. - (find-file-noselect (car file-list)) - - ;; Vertically split off a window of desired size. Upper window will - ;; have SIZE lines. Select lower (larger) window. We split it again. - (select-window (split-window nil size)) - (find-file (car file-list))) - - ;; Decrement. - (setq file-list (cdr file-list))))) - - -;;; MISCELLANEOUS COMMANDS. - -;; Run man on files. - -(defun dired-man () - "Run man on this file. Display old buffer if buffer name matches filename. -Uses `man.el' of \\[manual-entry] fame." - (interactive) - (require 'man) - (let* ((file (dired-get-filename)) - (manual-program (replace-regexp-in-string "\\*" "%s" - (dired-guess-shell-command - "Man command: " (list file))))) - (Man-getpage-in-background file))) - -;; Run Info on files. - -(defun dired-info () - "Run info on this file." - (interactive) - (info (dired-get-filename))) - -;; Run mail on mail folders. - -;; Avoid compiler warning. -(eval-when-compile - (when (not (fboundp 'vm-visit-folder)) - (defun vm-visit-folder (file &optional arg) - nil))) - -(defun dired-vm (&optional read-only) - "Run VM on this file. -With prefix arg, visit folder read-only (this requires at least VM 5). -See also variable `dired-vm-read-only-folders'." - (interactive "P") - (let ((dir (dired-current-directory)) - (fil (dired-get-filename))) - ;; take care to supply 2nd arg only if requested - may still run VM 4! - (cond (read-only (vm-visit-folder fil t)) - ((eq t dired-vm-read-only-folders) (vm-visit-folder fil t)) - ((null dired-vm-read-only-folders) (vm-visit-folder fil)) - (t (vm-visit-folder fil (not (file-writable-p fil))))) - ;; so that pressing `v' inside VM does prompt within current directory: - (set (make-local-variable 'vm-folder-directory) dir))) - -(defun dired-rmail () - "Run RMAIL on this file." - (interactive) - (rmail (dired-get-filename))) - -(defun dired-do-run-mail () - "If `dired-bind-vm' is t, then function `dired-vm', otherwise `dired-rmail'." - (interactive) - (if dired-bind-vm - ;; Read mail folder using vm. - (dired-vm) - ;; Read mail folder using rmail. - (dired-rmail))) - - -;;; MISCELLANEOUS INTERNAL FUNCTIONS. - -(declare-function dired-old-find-buffer-nocreate "dired-x") - -(or (fboundp 'dired-old-find-buffer-nocreate) - (fset 'dired-old-find-buffer-nocreate - (symbol-function 'dired-find-buffer-nocreate))) - -;; REDEFINE. -;; Redefines dired.el's version of `dired-find-buffer-nocreate' -(defun dired-find-buffer-nocreate (dirname &optional mode) - (if (and dired-find-subdir - ;; don't try to find a wildcard as a subdirectory - (string-equal dirname (file-name-directory dirname))) - (let* ((cur-buf (current-buffer)) - (buffers (nreverse - (dired-buffers-for-dir (expand-file-name dirname)))) - (cur-buf-matches (and (memq cur-buf buffers) - ;; wildcards must match, too: - (equal dired-directory dirname)))) - ;; We don't want to switch to the same buffer--- - (setq buffers (delq cur-buf buffers));;need setq with delq - (or (car (sort buffers (function dired-buffer-more-recently-used-p))) - ;; ---unless it's the only possibility: - (and cur-buf-matches cur-buf))) - (dired-old-find-buffer-nocreate dirname mode))) - -;; This should be a builtin -(defun dired-buffer-more-recently-used-p (buffer1 buffer2) - "Return t if BUFFER1 is more recently used than BUFFER2." - (if (equal buffer1 buffer2) - nil - (let ((more-recent nil) - (list (buffer-list))) - (while (and list - (not (setq more-recent (equal buffer1 (car list)))) - (not (equal buffer2 (car list)))) - (setq list (cdr list))) - more-recent))) - -;; Same thing as `dired-buffers-for-dir' of dired.el? - lrd 11/23/93 -;; (defun dired-buffers-for-dir-exact (dir) -;; ;; Return a list of buffers that dired DIR (a directory or wildcard) -;; ;; at top level, or as subdirectory. -;; ;; Top level matches must match the wildcard part too, if any. -;; ;; The list is in reverse order of buffer creation, most recent last. -;; ;; As a side effect, killed dired buffers for DIR are removed from -;; ;; dired-buffers. -;; (let ((alist dired-buffers) result elt) -;; (while alist -;; (setq elt (car alist) -;; alist (cdr alist)) -;; (let ((buf (cdr elt))) -;; (if (buffer-name buf) -;; ;; Top level must match exactly against dired-directory in -;; ;; case one of them is a wildcard. -;; (if (or (equal dir (with-current-buffer buf dired-directory)) -;; (assoc dir (with-current-buffer buf dired-subdir-alist))) -;; (setq result (cons buf result))) -;; ;; else buffer is killed - clean up: -;; (setq dired-buffers (delq elt dired-buffers))))) -;; result)) - -;; REDEFINE. -;; Redefines dired.el's version of `dired-initial-position' -(defun dired-initial-position (dirname) - "Where point should go in a new listing of DIRNAME. -Point assumed at beginning of new subdir line. -You may redefine this function as you wish, e.g. like in `dired-x.el'." - (end-of-line) - (if dired-find-subdir (dired-goto-subdir dirname)) ; new - (if dired-trivial-filenames (dired-goto-next-nontrivial-file))) - - -;; Does anyone use this? - lrd 6/29/93. -;; Apparently people do use it. - lrd 12/22/97. -(defun dired-mark-sexp (predicate &optional unflag-p) - "Mark files for which PREDICATE returns non-nil. -With a prefix arg, unflag those files instead. - -PREDICATE is a lisp expression that can refer to the following symbols: - - inode [integer] the inode of the file (only for ls -i output) - s [integer] the size of the file for ls -s output - (usually in blocks or, with -k, in KByte) - mode [string] file permission bits, e.g. \"-rw-r--r--\" - nlink [integer] number of links to file - uid [string] owner - gid [string] group (If the gid is not displayed by ls, - this will still be set (to the same as uid)) - size [integer] file size in bytes - time [string] the time that ls displays, e.g. \"Feb 12 14:17\" - name [string] the name of the file - sym [string] if file is a symbolic link, the linked-to name, else \"\" - -For example, use - - (equal 0 size) - -to mark all zero length files." - ;; Using sym="" instead of nil avoids the trap of - ;; (string-match "foo" sym) into which a user would soon fall. - ;; Give `equal' instead of `=' in the example, as this works on - ;; integers and strings. - (interactive "xMark if (lisp expr): \nP") - (message "%s" predicate) - (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)) - inode s mode nlink uid gid size time name sym) - (dired-mark-if - (save-excursion - (and - ;; Sets vars - ;; inode s mode nlink uid gid size time name sym - - ;; according to current file line. Returns t for success, nil if - ;; there is no file line. Upon success, all variables are set, either - ;; to nil or the appropriate value, so they need not be initialized. - ;; Moves point within the current line. - (if (dired-move-to-filename) - (let (pos - (mode-len 10) ; length of mode string - ;; like in dired.el, but with subexpressions \1=inode, \2=s: - (dired-re-inode-size "\\s *\\([0-9]*\\)\\s *\\([0-9]*\\) ?")) - (beginning-of-line) - (forward-char 2) - (if (looking-at dired-re-inode-size) - (progn - (goto-char (match-end 0)) - (setq inode (string-to-number (buffer-substring (match-beginning 1) - (match-end 1))) - s (string-to-number (buffer-substring (match-beginning 2) - (match-end 2))))) - (setq inode nil - s nil)) - (setq mode (buffer-substring (point) (+ mode-len (point)))) - (forward-char mode-len) - (setq nlink (read (current-buffer))) - ;; Karsten Wenger fixed uid. - (setq uid (buffer-substring (+ (point) 1) - (progn (forward-word 1) (point)))) - (re-search-forward directory-listing-before-filename-regexp) - (goto-char (match-beginning 1)) - (forward-char -1) - (setq size (string-to-number (buffer-substring (save-excursion - (backward-word 1) - (setq pos (point))) - (point)))) - (goto-char pos) - (backward-word 1) - ;; if no gid is displayed, gid will be set to uid - ;; but user will then not reference it anyway in PREDICATE. - (setq gid (buffer-substring (save-excursion - (forward-word 1) (point)) - (point)) - time (buffer-substring (match-beginning 1) - (1- (dired-move-to-filename))) - name (buffer-substring (point) - (or - (dired-move-to-end-of-filename t) - (point))) - sym (progn - (if (looking-at " -> ") - (buffer-substring - (progn (forward-char 4) (point)) - (progn (end-of-line) (point))) - ""))) - t) - nil) - (eval predicate))) - (format "'%s file" predicate)))) - - -;;; FIND FILE AT POINT. - -(defvar dired-x-hands-off-my-keys t - "*Non-nil means don't bind `dired-x-find-file' over `find-file' on keyboard. -Similarly for `dired-x-find-file-other-window' over `find-file-other-window'. -If you change this variable after `dired-x.el' is loaded then do -\\[dired-x-bind-find-file].") - -;; Bind `dired-x-find-file{-other-window}' over wherever -;; `find-file{-other-window}' is bound? -(defun dired-x-bind-find-file () - "Bind `dired-x-find-file' in place of `find-file' \(or reverse\). -Similarly for `dired-x-find-file-other-window' and `find-file-other-window'. -Binding direction based on `dired-x-hands-off-my-keys'. -This function is part of `after-init-hook'." - (interactive) - (if (interactive-p) - (setq dired-x-hands-off-my-keys - (not (y-or-n-p "Bind dired-x-find-file over find-file? ")))) - (cond ((not dired-x-hands-off-my-keys) - (substitute-key-definition 'find-file - 'dired-x-find-file - (current-global-map)) - (substitute-key-definition 'find-file-other-window - 'dired-x-find-file-other-window - (current-global-map))) - (t - (substitute-key-definition 'dired-x-find-file - 'find-file - (current-global-map)) - (substitute-key-definition 'dired-x-find-file-other-window - 'find-file-other-window - (current-global-map)))) - ;; Clear mini-buffer. - (message nil)) - -;; Now call it so binding is correct and put on `after-init-hook' in case -;; user changes binding. -(dired-x-bind-find-file) -(add-hook 'after-init-hook 'dired-x-bind-find-file) - -(defun dired-x-find-file (filename) - "Edit file FILENAME. -May create a new window, or reuse an existing one. -See the function `display-buffer'. - -Identical to `find-file' except when called interactively, with a prefix arg -\(e.g., \\[universal-argument]\), in which case it guesses filename near point. -Useful for editing file mentioned in buffer you are viewing, -or to test if that file exists. Use minibuffer after snatching filename." - (interactive (list (read-filename-at-point "Find file: "))) - (find-file (expand-file-name filename))) - -(defun dired-x-find-file-other-window (filename) - "Edit file FILENAME, in another window. -May create a new window, or reuse an existing one. -See the function `display-buffer'. - -Identical to `find-file-other-window' except when called interactively, with a -prefix arg \(e.g., \\[universal-argument]\), in which case it guesses filename near point. -Useful for editing file mentioned in buffer you are viewing, -or to test if that file exists. Use minibuffer after snatching filename." - (interactive (list (read-filename-at-point "Find file: "))) - (find-file-other-window (expand-file-name filename))) - -;;; Internal functions. - -;; Fixme: This should probably use `thing-at-point'. -- fx -(defun dired-filename-at-point () - "Get the filename closest to point, but do not change position. -Has a preference for looking backward when not directly on a symbol. Not -perfect - point must be in middle of or end of filename." - - (let ((filename-chars "-.[:alnum:]_/:$+@") - start end filename prefix) - - (save-excursion - ;; First see if just past a filename. - (if (not (eobp)) - (if (looking-at "[] \t\n[{}()]") ; whitespace or some parens - (progn - (skip-chars-backward " \n\t\r({[]})") - (if (not (bobp)) - (backward-char 1))))) - - (if (string-match (concat "[" filename-chars "]") - (char-to-string (following-char))) - (progn - (if (re-search-backward (concat "[^" filename-chars "]") nil t) - (forward-char) - (goto-char (point-min))) - (setq start (point)) - (setq prefix - (and (string-match - "^\\w+@" - (buffer-substring start (line-beginning-position))) - "/")) - (goto-char start) - (if (string-match "[/~]" (char-to-string (preceding-char))) - (setq start (1- start))) - (re-search-forward (concat "\\=[" filename-chars "]*") nil t)) - - (error "No file found around point!")) - - ;; Return string. - (expand-file-name (concat prefix (buffer-substring start (point))))))) - -(defun read-filename-at-point (prompt) - "Return filename prompting with PROMPT with completion. -If `current-prefix-arg' is non-nil, uses name at point as guess." - (if current-prefix-arg - (let ((guess (dired-filename-at-point))) - (read-file-name prompt - (file-name-directory guess) - guess - nil (file-name-nondirectory guess))) - (read-file-name prompt default-directory))) - -;;; BUG REPORTS - -;; Fixme: get rid of this later. - -;; This section is provided for reports. It uses Barry A. Warsaw's -;; reporter.el which is bundled with GNU Emacs v19. - -(defconst dired-x-help-address "bug-gnu-emacs@gnu.org" - "Address(es) accepting submission of reports on dired-x.el.") - -(defconst dired-x-variable-list - (list - 'dired-bind-vm - 'dired-vm-read-only-folders - 'dired-bind-jump - 'dired-bind-info - 'dired-bind-man - 'dired-find-subdir - 'dired-enable-local-variables - 'dired-local-variables-file - 'dired-guess-shell-gnutar - 'dired-guess-shell-gzip-quiet - 'dired-guess-shell-znew-switches - 'dired-guess-shell-alist-user - 'dired-clean-up-buffers-too - 'dired-omit-mode - 'dired-omit-files - 'dired-omit-extensions - ) - "List of variables to be appended to reports sent by `dired-x-submit-report'.") - -(defun dired-x-submit-report () - "Submit via `reporter.el' a bug report on program. -Send report on `dired-x-file' version `dired-x-version,' to -`dired-x-maintainer' at address `dired-x-help-address' listing -variables `dired-x-variable-list' in the message." - (interactive) - - (reporter-submit-bug-report - dired-x-help-address ; address - "dired-x" ; pkgname - dired-x-variable-list ; varlist - nil nil ; pre-/post-hooks - "")) - - -;; As Barry Warsaw would say: "This might be useful..." -(provide 'dired-x) - -;; arch-tag: 71a43ba2-7a00-4793-a028-0613dd7765ae -;;; dired-x.el ends here diff --git a/vendor/dirtree.el b/vendor/dirtree.el deleted file mode 100644 index 180cbec..0000000 --- a/vendor/dirtree.el +++ /dev/null @@ -1,180 +0,0 @@ -;;; dirtree.el --- Directory tree views - -;; Copyright (C) 2010 Free Software Foundation, Inc. -;; -;; Author: Ye Wenbin -;; Maintainer: Ye Wenbin -;; 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 diff --git a/vendor/imenu-tree.el b/vendor/imenu-tree.el deleted file mode 100644 index 261dcd1..0000000 --- a/vendor/imenu-tree.el +++ /dev/null @@ -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) "")) - "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 diff --git a/vendor/tree-mode.el b/vendor/tree-mode.el deleted file mode 100644 index 3e3b2e9..0000000 --- a/vendor/tree-mode.el +++ /dev/null @@ -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 diff --git a/vendor/tree-widget/imenu/bucket.xpm b/vendor/tree-widget/imenu/bucket.xpm deleted file mode 100644 index acdae43..0000000 --- a/vendor/tree-widget/imenu/bucket.xpm +++ /dev/null @@ -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 "}; diff --git a/vendor/tree-widget/imenu/close.png b/vendor/tree-widget/imenu/close.png deleted file mode 100644 index 3a509b095f80b8f6e052a2408bf1542eb25f26c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9Ew8X(O0RpIGbpdfpRr>`sfHC91(E7Q2e&yE9yWJ_ElN}Tg^b5rw57@Uhz6H8K4 z6v{J8G895GQWe}ieFNU7sOA9`_IbKEhFF|_dwC=8AqN4Mi|J1i)-!K^AhhDRu7FUS z+i+4Z@a79*s)`|qSBYYKbJ0PTb8+0#NR1WZ{y*#pMe{~{4}R>Upu|g c #C6C663", -", c #C6C66B", -"' c #CECE73", -" ", -" ", -" ", -" ", -" ", -" ", -" .... ", -".+@@#....... ", -".....$%%&&*=. ", -".-;;$%%&&*==. ", -".;;$%%&&*===. ", -".;$%%&&*===>. ", -".$%%&&*===>,. ", -".%%&&*===>,,. ", -".%&&*===>,,'. ", -"............. ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/empty.png b/vendor/tree-widget/imenu/empty.png deleted file mode 100644 index 3f89471828d9994777a7e75df6ab256a05d95ff0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9Ew8X(O0RpIGbpdfpRr>`sfHC91(O98vCL}#FoY>8_`iF1B#Zfaf$gL6@8Vo7R> zLV0FMhC)b2s)D>FSPf+>J&D)bA`F}^R~U;>pYUv{K8WNZ>kzFl)W=Q$9!hh=QDe` s1up7F-sj&xp*T)zRzBOCgZdwt&L!Kfd2IVZ0q8&mPgg&ebxsLQ0MV#r`Tzg` diff --git a/vendor/tree-widget/imenu/empty.xpm b/vendor/tree-widget/imenu/empty.xpm deleted file mode 100644 index 598401a..0000000 --- a/vendor/tree-widget/imenu/empty.xpm +++ /dev/null @@ -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", -" ", -" ", -" ", -" ", -" ", -" ", -" .... ", -".+++@..... ", -".++@@@##$$. ", -".+@.......... ", -".@.%%%&&&**==. ", -".@.%%&&&**==. ", -"..%%&&&**===. ", -"..%&&&**===. ", -".%&&&**===$. ", -"........... ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/end-guide.png b/vendor/tree-widget/imenu/end-guide.png deleted file mode 100644 index b1290f31e6f5437c4a49788f331fdd4b51088de2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^Y(Ol=0U{quy}b+)Nb+`fVfYV%3-&Ib3>4uk@Q5sC zVBk^%VaC9fD~*AI>?NMQuI$%X1v#X(LNa!~0Sd{MxJHyX=jZ08=9Mrw7o{eaq^2m8 zXO?6rgk+>DxO@5ryiZZh11c2tba4#PIG>!Lz`7>3>W%&36@7y23}Ih|x;HIQ?FTAg N@O1TaS?83{1OPSQF@yjB diff --git a/vendor/tree-widget/imenu/end-guide.xpm b/vendor/tree-widget/imenu/end-guide.xpm deleted file mode 100644 index 6788538..0000000 --- a/vendor/tree-widget/imenu/end-guide.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * end_guide_xpm[] = { -"6 22 2 1", -" c None", -". c #ADA5C6", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/function.xpm b/vendor/tree-widget/imenu/function.xpm deleted file mode 100644 index 78f3828..0000000 --- a/vendor/tree-widget/imenu/function.xpm +++ /dev/null @@ -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", -" ", -" ...+ ", -" .@#@.+ ", -" .# +.# ", -" $$$$++ .....+ ", -" $%&*=-+ ..@..# ", -"$%&;=>,-+.@#@.+ ", -"$&;=>,%'#..@..# ", -"$*)!,%~-+.....+ ", -"$)>,%~{'#+#+#+# ", -"+$,%~{'# ", -" +-'-'# ", -" +#+# ", -" "}; diff --git a/vendor/tree-widget/imenu/guide.png b/vendor/tree-widget/imenu/guide.png deleted file mode 100644 index 8535f86f3bf7cd9327895266263c03f8d38b7154..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^Y(Ol=0U{quy}b+)Nb+`fVfYV%3-&Ib3>4uk@Q5sC zVBk^%VaC9fD~*AI>?NMQuI$%X1vz9?{!C=j0Sd{MxJHyX=jZ08=9Mrw7o{eaq^2m8 zXO?6rgk+>DxO@5ryiZZh11c2rba4#PIG>!Lz`7>3>W%&36@7xsnHgFX75^#Ci2Vgr O!QkoY=d#Wzp$PynoiStp diff --git a/vendor/tree-widget/imenu/guide.xpm b/vendor/tree-widget/imenu/guide.xpm deleted file mode 100644 index 647d059..0000000 --- a/vendor/tree-widget/imenu/guide.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * guide_xpm[] = { -"6 22 2 1", -" c None", -". c #ADA5C6", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" .", -" ", -" ."}; diff --git a/vendor/tree-widget/imenu/handle.png b/vendor/tree-widget/imenu/handle.png deleted file mode 100644 index cc5aa61b860d7e0c0a2fb7e4feae040e041a5c6c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^Ahs9>8<6~|#v2Qy*pj^6T^Rm@;DWu&Cj&(|3p^r= zfhsjXnDMK^)3ZQ9_7YEDSN3bHf*gvhw*;cj0EJ{rTq8=H^K)}k^GX<;i&7IyQd1Pl zGfOfQLNZbn+&z5*-lwSM0ToJkx;TbtoKH@WU_H#ZCbsI0z2O%Pi5>=qdyf1iS3fhe Q0@W~hy85}Sb4q9e08EE4`~Uy| diff --git a/vendor/tree-widget/imenu/handle.xpm b/vendor/tree-widget/imenu/handle.xpm deleted file mode 100644 index d3eb5f3..0000000 --- a/vendor/tree-widget/imenu/handle.xpm +++ /dev/null @@ -1,27 +0,0 @@ -/* XPM */ -static char * handle_xpm[] = { -"10 22 2 1", -" c None", -". c #ADA5C6", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . . . . .", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/leaf.png b/vendor/tree-widget/imenu/leaf.png deleted file mode 100644 index c15762b65705a1a176029470df6641405acae564..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9Ew8X(O0RpIGbpdfpRr>`sfHC91(Yt<S|xv6<249-QVi6yBi z3gww4844j8sS56%z5(x3RP%rew|KfZhFF|_J4sRKu!4YVyp?G8VK=3T6F15zUOy2z zVPcHx^^Tt2GrUnp{j75}=621h*?Ra~{crJxVEfgaig)^EeYPmt?OPwO7$5QW$>I7By^+FCzT16O azsuP0T~n+^YF;hS{S2P2elF{r5}E)F_4uk@Q5sC zVBk^%VaC9fD~*AI>?NMQuI$%X1vz9@C-pM_1`5fRxJHyX=jZ08=9Mrw7o{eaq^2m8 zXO?6rgk+>DxO@5ryiZZh11jYAba4#PIG>y#!MeCXfPsNYje)VJ)2ak0#o+1c=d#Wz Gp$P!7=PRKA diff --git a/vendor/tree-widget/imenu/no-guide.xpm b/vendor/tree-widget/imenu/no-guide.xpm deleted file mode 100644 index a74b840..0000000 --- a/vendor/tree-widget/imenu/no-guide.xpm +++ /dev/null @@ -1,26 +0,0 @@ -/* XPM */ -static char * no_guide_xpm[] = { -"6 22 1 1", -" c None", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/no-handle.png b/vendor/tree-widget/imenu/no-handle.png deleted file mode 100644 index 3055803a595fe2b37f910bb20b18bd7a42c91264..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^Ahs9>8<6~|#v2Qy*pj^6T^Rm@;DWu&Cj&(|3p^r= zfhsjXnDMK^)3ZQ9_7YEDSN3bHf*gvf59_K}fI_k*t`Q~9`MJ5Nc_j?aMX8A;sVNHO znI#ztAsML(?w-B@?^9IsfC>dYT^vI+&L<~Gur5vz;n87WU~XeztlrIG2b5&+boFyt I=akR{0Iq#2VgLXD diff --git a/vendor/tree-widget/imenu/no-handle.xpm b/vendor/tree-widget/imenu/no-handle.xpm deleted file mode 100644 index cea559f..0000000 --- a/vendor/tree-widget/imenu/no-handle.xpm +++ /dev/null @@ -1,26 +0,0 @@ -/* XPM */ -static char * no_handle_xpm[] = { -"10 22 1 1", -" c None", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/vendor/tree-widget/imenu/open.png b/vendor/tree-widget/imenu/open.png deleted file mode 100644 index 6696a43c09c9d60ec6a9f667738f3592ccebc4b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRr!3HExu9B$%Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9Ew8X(O0RpIGbpdfpRr>`sfHC91(EAIJ+e&+y%WJ_ElN}Tg^b5rw57@Uhz6H8K4 z6v{J8G895GQWe}ieFNU7sOA9`?(uYS46!)A7<1_xEO${aQ-iFo2J)O%#(35&;OHf1+zPk(5z-*%kuK$Me@nCtQNjT@#-c<#PO zUW0$mp+65Mtz<|`GI++|aQmLyy<6TDsY-H7m#_2Bf6N!&+v}opt%_fRVab$>x2}4v zythK;a>`}7%#FoQRUFyA-1QBzd6VoTwB*RSx%1gTe~DWM4fV&#LM diff --git a/vendor/tree-widget/imenu/open.xpm b/vendor/tree-widget/imenu/open.xpm deleted file mode 100644 index dfbf758..0000000 --- a/vendor/tree-widget/imenu/open.xpm +++ /dev/null @@ -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", -" ", -" ", -" ", -" ", -" ", -" ", -" .... ", -".+@@#..... ", -".@@##$$%%&. ", -".@#.......... ", -".#.*==--&%%;;. ", -".#.==--&%%;;. ", -"..==--&%%;;$. ", -"..=--&%%;;$. ", -".=--&%%;;$>. ", -"........... ", -" ", -" , ", -" ", -" , ", -" ", -" , "}; diff --git a/vendor/tree-widget/imenu/other.xpm b/vendor/tree-widget/imenu/other.xpm deleted file mode 100644 index 633a047..0000000 --- a/vendor/tree-widget/imenu/other.xpm +++ /dev/null @@ -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~+ ", -"$=~_~_~_# ", -" #+#+#+#+ ", -" "}; diff --git a/vendor/tree-widget/imenu/variable.xpm b/vendor/tree-widget/imenu/variable.xpm deleted file mode 100644 index 633a047..0000000 --- a/vendor/tree-widget/imenu/variable.xpm +++ /dev/null @@ -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~+ ", -"$=~_~_~_# ", -" #+#+#+#+ ", -" "}; diff --git a/vendor/windata.el b/vendor/windata.el deleted file mode 100644 index 86c336e..0000000 --- a/vendor/windata.el +++ /dev/null @@ -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