From 921632696e77bae4a6da4966807350d8287e2e1d Mon Sep 17 00:00:00 2001 From: berndl Date: Wed, 29 Jan 2003 14:34:33 +0000 Subject: [PATCH] tree-buffer-highlight-node-data now returns nil if no highlighting could be done. So now the caller can check this result and react suitable. General expanding of tree-buffers now possible. --- tree-buffer.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tree-buffer.el b/tree-buffer.el index b2b302e..6171aa0 100644 --- a/tree-buffer.el +++ b/tree-buffer.el @@ -440,17 +440,25 @@ START-NODE is nil or equal to the root-node then all nodes of current tree-buffer are searched from beginning until the node with data NODE-DATA has been found otherwise the search starts with START-NODE. If DONT-MAKE-VISIBLE is true then no tree-buffer recentering has been done to make this node -visible." +visible. + +If either NODE-DATA is nil or if the node belonging to NODE-DATA can not be +found because it is invisible \(probably because its parent-node is not +expanded) then no highlighting takes place but the existing highlighting is +removed and nil is returned. Otherwise the node is highlighted and not nil is +returned." (if node-data (let* ((name-node (tree-buffer-find-name-node-data node-data start-node)) (name (car name-node)) (node (cdr name-node)) (w (get-buffer-window (current-buffer)))) (if (null node) - ;; node can not be found because maybe the node is a subnode and - ;; itīs parent is not expanded --> then there is no node for - ;; NODE-DATA; therefore we must remove the highlighting - (tree-buffer-remove-highlight) + (progn + ;; node can not be found because maybe the node is a subnode and + ;; itīs parent is not expanded --> then there is no node for + ;; NODE-DATA; therefore we must remove the highlighting + (tree-buffer-remove-highlight) + nil) (setq tree-buffer-highlighted-node-data node-data) (save-excursion (move-overlay tree-buffer-highlight-overlay @@ -459,8 +467,11 @@ visible." (when (not dont-make-visible) ;; make node visible if not and optimize the windows display for ;; the node. - (tree-buffer-recenter node w)))) - (tree-buffer-remove-highlight))) + (tree-buffer-recenter node w)) + ;; we have highlighted the node wo we return not nil. + t)) + (tree-buffer-remove-highlight) + nil)) (defun tree-buffer-help-echo-fn (win obj pos) "This function is the value of the `help-echo' property of each