-(defun tree-widget--locate-sub-directory (name path)
- "Locate the sub-directory NAME in PATH.
-Return the absolute name of the directory found, or nil if not found."
- (let (dir elt)
- (while (and (not dir) (consp path))
- (setq elt (condition-case nil (eval (car path)) (error nil))
- path (cdr path))
- (cond
- ((stringp elt)
- (setq dir (expand-file-name name elt))
- (or (file-accessible-directory-p dir)
- (setq dir nil)))
- ((and elt (not (equal elt (car path))))
- (setq dir (tree-widget--locate-sub-directory name elt)))))
- dir))
-
-(defun tree-widget-themes-directory ()
- "Locate the directory where to search for a theme.
-It is defined in variable `tree-widget-themes-directory'.
-Return the absolute name of the directory found, or nil if the
-specified directory is not accessible."
- (let ((found (aref tree-widget--theme 1)))
+(defun tree-widget--locate-sub-directory (name path &optional found)
+ "Locate all occurrences of the sub-directory NAME in PATH.
+Return a list of absolute directory names in reverse order, or nil if
+not found."
+ (condition-case err
+ (dolist (elt path)
+ (setq elt (eval elt))
+ (cond
+ ((stringp elt)
+ (and (file-accessible-directory-p
+ (setq elt (expand-file-name name elt)))
+ (push elt found)))
+ (elt
+ (setq found (tree-widget--locate-sub-directory
+ name (if (atom elt) (list elt) elt) found)))))
+ (error
+ (message "In tree-widget--locate-sub-directory: %s"
+ (error-message-string err))))
+ found)
+
+(defun tree-widget-themes-path ()
+ "Return the path where to search for a theme.
+It is specified in variable `tree-widget-themes-directory'.
+Return a list of absolute directory names, or nil when no directory
+has been found accessible."
+ (let ((path (aref tree-widget--theme 1)))