Hello everyone. I sent the email below to the ECB list since I use ECB with CEDET, but it seems that this is the correct forum.
 
Does anyone have any thoughts on the request below? Thanks.
 

Javier


 


From: Oviedo, Javier
Sent: Friday, April 29, 2005 1:16 PM
To: klaus.berndl@sdm.de; ecb-list@lists.sourceforge.net
Subject: ECB and speedbar

Hello all:
 
I currently have the ecb directory window displaying speedbar instead of the proprietary ecb directory implementation.
 
When I open a buffer in the main edit window, I see that the directory window(speedbar) updates the directory path, but does not "recenter" the window on the currently active file. What I find is that I can only display X amount of files in the directory window, given the window size....and if I open a file which is in that directory, but not visible due to the size constraints, I have to manually scroll down and find it.
 
Is it possible to have this recentering such that the directory will display the newly opened buffer? I hope my request is clear.
 
Thanks.
 

Javier


 


From: klaus.berndl@sdm.de [mailto:klaus.berndl@sdm.de]
Sent: Wednesday, January 12, 2005 11:14 AM
To: Oviedo, Javier; hauke.jans@sesa.de; ecb-list@lists.sourceforge.net
Subject: AW: [ECB-list] Tagdefinition window for ecb

AFAIK in GNU Emacs etags.el this function is named find-tag-noselect - do not know if it does some different things but IMO this function has to be used with GNU Emacs... but i think this code is a very good starting point for intergarting such a new ECB-window into ECB - i'm planning to add a contrib-subdirectory to the ECB-directory where such contributions will be added and so shipped with the ECB-releases - with current stable CVS-snap ECB offers already a pretty straightforward API to create new ECB-windows - i have to add a chapter to the manual... and also some code-clearings more - but in general it should be quite usable now... the added ecb-examples.el should be a sufficient starting point for this...

hauke, could you please ajust your code to the new examples-file (only some new macros) and then tell me what are you missing in the ecb-examples.el or what is not explained good enough?!

Thanks,
Klaus


-----Ursprüngliche Nachricht-----
Von: ecb-list-admin@lists.sourceforge.net im Auftrag von Oviedo, Javier
Gesendet: Mi 12.01.2005 16:40
An: Jans, Hauke; ecb-list@lists.sourceforge.net
Betreff: RE: [ECB-list] Tagdefinition window for ecb

Hello Hauke,

Can this code be used for Emacs21.3 as well as XEmacs? I could not
locate any information on find-tag-internal, so I guess that is an
XEmacs only function?

I really like this concept, but it seems I might have to wait see if it
is integrated in ecb by Klaus.

Thanks.


 -------------
 Javier
 




  _____ 

        From: ecb-list-admin@lists.sourceforge.net
[mailto:ecb-list-admin@lists.sourceforge.net] On Behalf Of Jans, Hauke
        Sent: Wednesday, January 12, 2005 9:13 AM
        To: ecb-list@lists.sourceforge.net
        Subject: [ECB-list] Tagdefinition window for ecb
       
       

        Ok, after fiddling a lot with this, i came up with a first
working copy for this!

        The following will always show (if found via (find-tag)) the
definition of a tag under cursor in

        an ecb window.

        Tested with XEmacs, ECB 2.31 under Windows XP.

        

        Kind regards

        Hauke

        

        

        ;;;; define a custom buffer which shows the semantic context of
the definition
        ;;;; of a semantic tag in a ecb buffer.
        ;;;;; Youu should add a buffer of type "other" and name
"tagdefinition" into an ecb layout
        (require 'ecb-util)
        (require 'ecb-layout)
        (require 'ecb-common-browser)

       
        (defconst ecb-tagdefinition-buffer-name " *ECB Tagdefinition*")
        (defvar ecb-tagdefinition-last-file nil)
        (defvar ecb-tagdef-current nil)

        ;; buffer update function:
        (defun ecb-tagdefinition-update (buffer window)
          "Insert in buffer BUFFER the tag definition if found"
          (setq ecb-tagdef-current (symbol-near-point))
          (ecb-with-readonly-buffer buffer
            (ecb-mode-line-set (buffer-name (current-buffer))
                 (selected-frame) "* Def *" nil t)
            (setq truncate-lines t)
            (erase-buffer)
            (let*
         ((result (find-tag-internal (list ecb-tagdef-current)))
          (num-tag-lines (- (/ (window-displayed-height window) 2) 0))
          (tag-buf (car result))
          (tag-point (cdr result))
          (extend-point-min nil)
          (extend-point-max nil)
          )
              (ecb-mode-line-set (buffer-name (current-buffer))
            (selected-frame) (format "* Def %s <<%s>> *" (buffer-name
tag-buf) ecb-tagdef-current ) nil t)
              (with-current-buffer tag-buf
         (save-excursion
           (goto-char tag-point)
           (forward-line (- num-tag-lines))
           (setq extend-point-min (point))
           (forward-line num-tag-lines)
           (forward-line num-tag-lines)
           (setq extend-point-max (point))
           )
         )
        ;      (insert-buffer-substring tag-buf extend-point-min
extend-point-max)
              (insert (buffer-substring extend-point-min
extend-point-max tag-buf))
              (goto-char (point-min))
              (search-forward ecb-tagdef-current)
              (add-text-properties (match-beginning 0) (match-end 0)
              '(face highlight ))
              )
           
            )
          )

       
        (defun ecb-set-tagdefinition-buffer ()
          "Create the tagdefinition buffer"
          (ecb-with-dedicated-window
              ecb-tagdefinition-buffer-name
'ecb-set-tagdefinition-buffer
            (switch-to-buffer (get-buffer-create
ecb-tagdefinition-buffer-name))
            (setq buffer-read-only t)))

        (defun ecb-tagdefinition-sync ()
          "Synchronizes the buffer-info buffer with current source if
changed.
        Can be called interactively but normally this should not be
necessary because
        it will be called autom. with `ecb-current-buffer-sync-hook'."
          (interactive)

          (ecb-do-if-buffer-visible-in-ecb-frame
'ecb-tagdefinition-buffer-name
            ;; here we can be sure that the buffer with name
            ;; `ecb-examples-bufferinfo-buffer-name' is displayed in a
window of
            ;; `ecb-frame'.
           
            ;; The macro `ecb-do-if-buffer-visible-in-ecb-frame' binds
locally the
            ;; variables visible-buffer and visible-window:
            ;; visible-window:= (get-buffer-window
ecb-examples-bufferinfo-buffer-name)
            ;; visible-buffer:= (get-buffer
ecb-examples-bufferinfo-buffer-name)
           
            (ecb-tagdefinition-update visible-buffer visible-window)
            )
          )

        (defun ecb-tagdefinition-activate ()
          "Activate the tagdefinition display.
        Add `ecb-tagdefinition-sync' to `ecb-current-buffer-sync-hook',
set
        `ecb-compile-window-height' to 5 and `ecb-windows-height' to 6.
The
        preactivation-state is saved and will be restored by
        `ecb-tagdefinition-deactivate'."
          (interactive)

          (assert (featurep 'ecb) nil
                  "ECB must be loaded!")
          (assert ecb-minor-mode nil
                  "ECB must be activated!")
          (assert (equal (selected-frame) ecb-frame) nil
                  "The ECB-frame must be selected!")
         
          ;; activating the synchronization of the bufferinfo-window
          (add-hook 'ecb-current-buffer-sync-hook
             'ecb-tagdefinition-sync)
          )

        

        ;; Deactivation of the tagdefinition

        (defun ecb-tagdefinition-deactivate ()
          "Deactivate the tagdefinition display.
        Remove `ecb-tagdefinition-sync' from
`ecb-current-buffer-sync-hook' and
        restore the state as before activation."
          (interactive)

          (assert (featurep 'ecb) nil
                  "ECB must be loaded!")
          (assert ecb-minor-mode nil
                  "ECB must be activated!")
          (assert (equal (selected-frame) ecb-frame) nil
                  "The ECB-frame must be selected!")
         
          (remove-hook 'ecb-current-buffer-sync-hook
                       'ecb-tagdefinition-sync)
          )