From 77dd9879a9fe423ce4b9f000bc7e3def8489d582 Mon Sep 17 00:00:00 2001 From: Hiroaki Otsu Date: Tue, 11 Feb 2014 03:12:47 +0900 Subject: [PATCH 1/3] no expand the ignored child dirs --- direx.el | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/direx.el b/direx.el index 78b4a3e..f32a3f9 100644 --- a/direx.el +++ b/direx.el @@ -58,6 +58,12 @@ :type 'string :group 'direx) +(defcustom direx:ignored-dirs-regexp + (concat "^" (regexp-opt '(".svn" ".git" ".hg")) "$") + "" + :type 'string + :group 'direx) + ;;; Utilities @@ -338,10 +344,12 @@ mouse-2: find this node in other window")) (unless (direx:item-open item) (direx:item-expand item))) -(defun direx:item-expand-recursively (item) - (direx:item-expand item) - (dolist (child (direx:item-children item)) - (direx:item-expand-recursively child))) +(defun direx:item-expand-recursively (item &optional noexpand-ignored) + (when (or (not noexpand-ignored) + (not (eq (direx:item-face item) 'dired-ignored))) + (direx:item-expand item) + (dolist (child (direx:item-children item)) + (direx:item-expand-recursively child t)))) (defun direx:item-collapse (item) (unless (direx:item-leaf-p item) @@ -578,11 +586,15 @@ mouse-2: find this node in other window")) (display-buffer (dired-noselect dirname)))) (defmethod direx:make-item ((dir direx:directory) parent) - (make-instance 'direx:directory-item - :tree dir - :parent parent - :face 'dired-directory - :keymap direx:file-keymap)) + (let* ((basename (direx:tree-name dir)) + (face (or (when (string-match direx:ignored-dirs-regexp basename) + 'dired-ignored) + 'dired-directory))) + (make-instance 'direx:directory-item + :tree dir + :parent parent + :face face + :keymap direx:file-keymap))) From 529a8d28f3849a11e1f2d4055d7bc1da8a22bc78 Mon Sep 17 00:00:00 2001 From: Hiroaki Otsu Date: Tue, 11 Feb 2014 13:16:35 +0900 Subject: [PATCH 2/3] fixed the point --- direx.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/direx.el b/direx.el index f32a3f9..0d7232f 100644 --- a/direx.el +++ b/direx.el @@ -59,7 +59,7 @@ :group 'direx) (defcustom direx:ignored-dirs-regexp - (concat "^" (regexp-opt '(".svn" ".git" ".hg")) "$") + (concat "\\`" (regexp-opt '(".svn" ".git" ".hg")) "\\'") "" :type 'string :group 'direx) @@ -587,9 +587,9 @@ mouse-2: find this node in other window")) (defmethod direx:make-item ((dir direx:directory) parent) (let* ((basename (direx:tree-name dir)) - (face (or (when (string-match direx:ignored-dirs-regexp basename) - 'dired-ignored) - 'dired-directory))) + (face (if (string-match direx:ignored-dirs-regexp basename) + 'dired-ignored + 'dired-directory))) (make-instance 'direx:directory-item :tree dir :parent parent From 3ea8288e9fc5af1c185b3ff80e5ad3fea083d630 Mon Sep 17 00:00:00 2001 From: Hiroaki Otsu Date: Sun, 23 Mar 2014 23:17:50 +0900 Subject: [PATCH 3/3] added slot of item for ignore --- direx.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/direx.el b/direx.el index 0d7232f..d3496ca 100644 --- a/direx.el +++ b/direx.el @@ -178,6 +178,8 @@ descendants. You may add a heuristic method for speed.") :accessor direx:item-face) (keymap :initarg :keymap :accessor direx:item-keymap) + (ignore :initarg :ignore + :accessor direx:item-ignore) (overlay :accessor direx:item-overlay) (open :accessor direx:item-open))) @@ -346,7 +348,7 @@ mouse-2: find this node in other window")) (defun direx:item-expand-recursively (item &optional noexpand-ignored) (when (or (not noexpand-ignored) - (not (eq (direx:item-face item) 'dired-ignored))) + (not (direx:item-ignore item))) (direx:item-expand item) (dolist (child (direx:item-children item)) (direx:item-expand-recursively child t)))) @@ -570,7 +572,8 @@ mouse-2: find this node in other window")) :tree file :parent parent :face face - :keymap direx:file-keymap))) + :keymap direx:file-keymap + :ignore (eq face 'dired-ignored)))) (defclass direx:directory-item (direx:file-item) ()) @@ -594,7 +597,8 @@ mouse-2: find this node in other window")) :tree dir :parent parent :face face - :keymap direx:file-keymap))) + :keymap direx:file-keymap + :ignore (eq face 'dired-ignored))))