From: Oviedo, J. <jo...@ti...> - 2005-04-29 17:16:22
|
Hello all: =20 I currently have the ecb directory window displaying speedbar instead of = the proprietary ecb directory implementation. =20 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. =20 Is it possible to have this recentering such that the directory will = display the newly opened buffer? I hope my request is clear.=20 =20 Thanks. =20 Javier=20 =20 _____ =20 From: kla...@sd... [mailto:kla...@sd...]=20 Sent: Wednesday, January 12, 2005 11:14 AM To: Oviedo, Javier; hau...@se...; ecb...@li... Subject: AW: [ECB-list] Tagdefinition window for ecb =09 =09 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... =09 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?! =09 Thanks, Klaus =09 =09 -----Urspr=FCngliche Nachricht----- Von: ecb...@li... im Auftrag von Oviedo, Javier Gesendet: Mi 12.01.2005 16:40 An: Jans, Hauke; ecb...@li... Betreff: RE: [ECB-list] Tagdefinition window for ecb =09 Hello Hauke, =09 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? =09 I really like this concept, but it seems I might have to wait see if it is integrated in ecb by Klaus. =09 Thanks. =09 =09 ------------- Javier =20 =09 =09 =09 =09 _____=20 =09 From: ecb...@li... [mailto:ecb...@li...] On Behalf Of Jans, Hauke Sent: Wednesday, January 12, 2005 9:13 AM To: ecb...@li... Subject: [ECB-list] Tagdefinition window for ecb =20 =20 =09 Ok, after fiddling a lot with this, i came up with a first working copy for this! =09 The following will always show (if found via (find-tag)) the definition of a tag under cursor in =09 an ecb window. =09 Tested with XEmacs, ECB 2.31 under Windows XP. =09 =20 =09 Kind regards =09 Hauke =09 =20 =09 =20 =09 ;;;; 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) =09 =20 (defconst ecb-tagdefinition-buffer-name " *ECB Tagdefinition*") (defvar ecb-tagdefinition-last-file nil) (defvar ecb-tagdef-current nil) =09 ;; 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 )) ) =20 ) ) =09 =20 (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))) =09 (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) =09 (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'. =20 ;; The macro `ecb-do-if-buffer-visible-in-ecb-frame' binds locally the ;; variables visible-buffer and visible-window: ;; visible-window:=3D (get-buffer-window ecb-examples-bufferinfo-buffer-name) ;; visible-buffer:=3D (get-buffer ecb-examples-bufferinfo-buffer-name) =20 (ecb-tagdefinition-update visible-buffer visible-window) ) ) =09 (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) =09 (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!") =20 ;; activating the synchronization of the bufferinfo-window (add-hook 'ecb-current-buffer-sync-hook 'ecb-tagdefinition-sync) ) =09 =20 =09 ;; Deactivation of the tagdefinition =09 (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) =09 (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!") =20 (remove-hook 'ecb-current-buffer-sync-hook 'ecb-tagdefinition-sync) ) =20 =09 =20 =09 =09 =09 |