Skip to content

Commit

Permalink
Smarter mechanism to highlight the current tag in the Methods-buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
berndl committed Feb 28, 2004
1 parent 5060231 commit 22235ca
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 223 deletions.
27 changes: 27 additions & 0 deletions NEWS
Expand Up @@ -20,6 +20,28 @@
class is filtered out then no filter can be applied to its members like
methods or attributes.

These tag-filters can also applied to sources which are not supported by
the semantic-parser but "only" by imenu or etags. But because for these
sources not all information are avaiable the protection- and tag-class
filter can not used with such "non-semantic"-sources.

** Much smarter mechanism to highlight the current tag in the methods-buffer.
Previous versions of ECB have always expanded the whole tree in the
Methods-buffer if the current tag in the source-buffer was not visible in
the current tree - e.g. because the variables-bucket was collapsed or the
containing type of a tag (e.g. the class of a method) was collapsed. So in
most cases much more was expanded as needed to make the current tag
visible.

The mechanism of ECB 2.22 only expands the needed parts of the tree-buffer
to make the related node visible: First we try to highlight the current tag
with current expansion-state of the Methods-buffer. If the node is not
visible so the tag can not be highlighted then we go upstairs the ladder of
type-tags the current tag belongs to (e.g. we expand successive the nodes
of the whole class-hierachy of the current method-tag until the related
node becomes visible). Only if this has still no success then we expand the
full tree-buffer and try to highlight the current tag.

** The popup-menus can now be nested into 4 levels of submenus. In general there
could be an infinite depth of nesting but it makes no sense - if possible
at all - to define infinite nested defcustom-types. So there is a limit of
Expand Down Expand Up @@ -48,6 +70,11 @@
*** Fixed a small bug in `ecb-toggle-compile-window-height'. This bug has
influenced the behavior of `display-buffer' when called from programs for
"compilation-buffers".

*** Fixed a bug related to the speedbar-integration.
This bug complained "Can not switch buffer in dedicated window" when the
intergrated speedbar-buffer was selected and the user tries to open a file
or to jump to a tag.



Expand Down
4 changes: 3 additions & 1 deletion ecb-file-browser.el
Expand Up @@ -1567,7 +1567,9 @@ can last a long time - depending of machine- and disk-performance."
(interactive "nLevel: ")
(save-selected-window
(ecb-exec-in-directories-window
(tree-buffer-expand-nodes level)))
(dolist (node (tree-node-get-children (tree-buffer-get-root)))
(tree-buffer-expand-node node level))
(tree-buffer-update)))
(ecb-current-buffer-sync 'force))


Expand Down
38 changes: 28 additions & 10 deletions ecb-layout.el
Expand Up @@ -2317,13 +2317,34 @@ EDIT-WIN-NR must be an integer between 1 and length of EDIT-WIN-LIST \(rsp.
(equal (selected-window) ecb-compile-window)))


(defun ecb-point-in-tree-buffer ()
"Return nil if point is not in any tree-buffer of ECB otherwise return the
buffer-object."
(defun ecb-point-in-ecb-tree-buffer ()
"Return nil if point is not in any of the standard tree-buffers \(currently
these are the buffers with name `ecb-directories-buffer-name',
`ecb-sources-buffer-name', `ecb-methods-buffer-name' and
`ecb-history-buffer-name') of ECB otherwise return the buffer-object."
(when (and (equal (selected-frame) ecb-frame)
(member (buffer-name (current-buffer)) ecb-tree-buffers))
(current-buffer)))

(defun ecb-dedicated-special-buffers ()
"Return a list of these special dedicated buffers which are registrated via
the macro `ecb-with-dedicated-window' \(these are normally only the standard
tree-buffers of ECB plus the integrated speedbar-buffer, but in general it can
be more if there are additional buffers registrated, e.g. by other
applications)."
(delq nil (mapcar (function (lambda (e)
(get-buffer (car e))))
ecb-buffer-setfunction-registration)))

(defun ecb-point-in-dedicated-special-buffer ()
"Return nil if point is not in any of these special dedicated buffers which
are registrated via the macro `ecb-with-dedicated-window' \(see
`ecb-dedicated-special-buffers'). Otherwise return the buffer-object."
(when (equal (selected-frame) ecb-frame)
(if (member (current-buffer) (ecb-dedicated-special-buffers))
(current-buffer))))


(defun ecb-point-in-ecb-window ()
"Return nil if point is not in any of the special dedicated ECB-windows
otherwise return the window-object of this ECB-window. This works for every
Expand Down Expand Up @@ -2394,10 +2415,7 @@ can use these variables."
;; We MUST not use here `ecb-point-in-edit-window' because this would
;; slow-down the performance of all Emacs-versions unless GNU Emacs 21
;; because they have no builtin `window-list'-function.
(when (and (not (ecb-point-in-tree-buffer))
;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: Do we need this
;; check elsewhere??
(not (ecb-speedbar-buffer-selected))
(when (and (not (ecb-point-in-dedicated-special-buffer))
(not (equal (minibuffer-window ecb-frame)
(selected-window)))
(not (ecb-point-in-compile-window)))
Expand All @@ -2410,7 +2428,7 @@ can use these variables."
(current-buffer)))
(setq ecb-compile-window-was-selected-before-command nil)
(setq ecb-last-compile-buffer-in-compile-window nil))
(if (member (buffer-name) ecb-tree-buffers)
(if (ecb-point-in-dedicated-special-buffer)
(setq ecb-ecb-window-was-selected-before-command (buffer-name))
(setq ecb-ecb-window-was-selected-before-command nil))))

Expand Down Expand Up @@ -2457,10 +2475,10 @@ some special tasks:
(equal (selected-frame) ecb-frame)
(= (minibuffer-depth) 0))
(cond ((and (not ecb-ecb-window-was-selected-before-command)
(ecb-point-in-tree-buffer))
(ecb-point-in-dedicated-special-buffer))
(ecb-display-one-ecb-buffer (buffer-name)))
((and ecb-ecb-window-was-selected-before-command
(not (ecb-point-in-tree-buffer)))
(not (ecb-point-in-dedicated-special-buffer)))
(ecb-redraw-layout-full nil nil nil nil))))))
;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: need some more tests - see above
;; `ecb-minibuffer-exit-hook'
Expand Down

0 comments on commit 22235ca

Please sign in to comment.