From cb3afad9ba794f428cbee9b6099c027e680b88f4 Mon Sep 17 00:00:00 2001 From: berndl Date: Fri, 27 Jan 2006 18:21:47 +0000 Subject: [PATCH] Changes for the next version with some big-fixes and some preparements for better code --- Makefile | 4 +- NEWS | 36 +- README | 2 +- RELEASE_NOTES | 2 +- ecb-analyse.el | 2 + ecb-common-browser.el | 108 +++++- ecb-file-browser.el | 129 +++++++ ecb-method-browser.el | 48 ++- ecb-semantic-wrapper.el | 28 +- ecb-symboldef.el | 771 ++++++++++++++++++++-------------------- ecb-upgrade.el | 102 ++++-- ecb.el | 164 ++------- ecb.texi | 141 +++++--- html/ecb-html.el | 15 +- 14 files changed, 907 insertions(+), 645 deletions(-) diff --git a/Makefile b/Makefile index 73eab5db..17942b11 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ INSTALLINFO=/usr/bin/install-info # For the ECB-maintainers: Change the version-number here and not # elsewhere! -ecb_VERSION=2.32beta3 +ecb_VERSION=2.32 include ecb-makedef.mk @@ -228,7 +228,7 @@ pdf: $(ecb_TEXI) install-help: $(ecb_INFO_DIR)/$(ecb_INFO) @if test -x "$(INSTALLINFO)" -a -f "$(EMACSINFOPATH)/dir"; then\ - echo Installing the Online-help in $(INSTALLINFO)...; \ + echo Installing the Online-help in $(EMACSINFOPATH)...; \ $(CP) $(ecb_INFO_DIR)/*info* $(EMACSINFOPATH); \ $(INSTALLINFO) $< $(EMACSINFOPATH)/dir; \ else \ diff --git a/NEWS b/NEWS index 43c737a9..07e18688 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,26 @@ -* Changes for ECB version 2.32beta3 +* Changes for ECB version 2.33beta1 + +** Fixed Bugs + +*** Fixed problems with the internal download of newer ECB-versions + Seems that two different URLs are needed: + - "ftp://ftp1.sourceforge.net/pub/sourceforge/e/ec/ecb/" (see variable + `ecb-packagelist-ecb-url') for getting a list of all available + package-versions + - "http://ftp1.sourceforge.net/ecb/" (see option `ecb-download-ecb-url') + for the real download of a certain version of the package (e.g. + ecb-2.32.tar.gz) + Downloading does not work with the former one and getting a packagelist is + not possible with the latter one. Therefore ECB now uses both URLs. + + + +* Changes for ECB version 2.32 ** New backbone-add-on of ECB for getting the definition of the symbol at point It allows to display in a new special ECB-window the semantic (do not - confuse this trem with the semantic-library!) context of the definition of + confuse this term with the semantic-library!) context of the definition of the current symbol under point. Per default ECB tries to find this context via semanticdb (part of cedet) and etags (shipped with (X)Emacs) but in general this is completely customizable; see the options of the new @@ -13,8 +30,16 @@ new ecb-layout via the command `ecb-create-new-layout' and add a buffer of type "other" and name "symboldef" into this new layout. + This add-on interactior can be seen as a "backbone" infrastructure, because + it is/should be highly customizable how to get the definition of the symbol + at point (e.g. via semanticdb or etags or whatever). + Thanks to Hauke Wintjen for having the idea - and writing the first implementation! + and writing the first implementation + + This add-on interactor of ECB is currently in beta or gamma stage but works + already quite well. So please try it out and send feedback to the + ECB-mailing-list. Every suggestion is highly appretiated! ** New native ECB-display interactor for the semantic-analyzer There is a new tree-buffer ECB-analyse which displays the tags and @@ -108,6 +133,11 @@ ECB requires now (X)Emacs >= 21. ECB stops activation with an appropriate error-message when (X)Emacs < 21 is detected. +** Full documentation of the library tree-buffer.el + The ECB-info-manual contains a new section "tree-buffer" in the chapter + "Entry points for elisp-programers". This describes in detail how to + program with the library tree-buffer.el which is shipped with ECB. + ** Fixed Bugs *** Version-controlled (VC) and not-VC history-entries are now sorted diff --git a/README b/README index 587013c1..9d6c4724 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -README for the Emacs Code Browser (ECB) version 2.32beta3 +README for the Emacs Code Browser (ECB) version 2.32 About diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 14423916..f77a7660 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,4 +1,4 @@ -This file contains some important release-notes for ECB version 2.32beta3 +This file contains some important release-notes for ECB version 2.32 General: -------- diff --git a/ecb-analyse.el b/ecb-analyse.el index 9f2ed54b..433e048f 100644 --- a/ecb-analyse.el +++ b/ecb-analyse.el @@ -228,6 +228,8 @@ See also `ecb-analyse-gen-tag-info-fn'." (defconst ecb-analyse-nodetype-function 7) (defconst ecb-analyse-nodetype-function-arg 8) + + (defun ecb-analyse-buffer-sync () "Synchronize the analyse buffer with the current buffer and point. This means in fact display the current analysis for current point." diff --git a/ecb-common-browser.el b/ecb-common-browser.el index f45b370e..97eab597 100644 --- a/ecb-common-browser.el +++ b/ecb-common-browser.el @@ -830,6 +830,106 @@ not nil then in both PATH and FILENAME env-var substitution is done. If the ;; -- end of canonical filenames +;; -- interactors synchronizers + +(defvar ecb-interactor-synchronizers nil) + +;; TODO: Klaus Berndl : Only called from within +;; `defecb-interactor-synchronizer'. +(defun ecb-interactor-synchronizer-register (buffer-name-symbol + synchronizer-fcn) + "" + ) + +;; TODO: Klaus Berndl : This function can only be used if +;; a synchronizer is already registered. +(defun ecb-interactor-synchronizer-activate (&optional arg) + "Activate if ARG >= 0, deactivate if ARG < 0. Toggle if ARG is nil." + ) + +;; TODO: Klaus Berndl : We do not change the +;; synchronizing of the basic-interactors! eshell and speedbar synchonizing +;; won't be changed too. So the internal-hook still remains for this stuff! But +;; all add-on-interactors (currently analyse and symboldef) MUST use the new +;; macro `defecb-interactor-synchronizer' for their synchronizers! For these +;; we introduce also a new option `ecb-add-on-interactor-sync-delay' (if a +;; buffer is not contained it will not be synced anymore!) which allows adding +;; delays for these interactors. In addition we rename `ecb-window-sync' to +;; `ecb-interactor-sync' and `ecb-window-sync-delay' to +;; `ecb-basic-interactor-sync-delay'. Maybe there are further +;; options/functions/commands to rename!? + +;; TODO: Klaus Berndl : Hmmmmmmm, maybe we should ensure +;; that the add-on synchonizers will always being called AFTER the basic ones? +;; For this we should name the new option +;; `ecb-add-on-interactor-sync-delay-plus' which means each add-on interactor +;; has at elast the basic delay of `ecb-basic-interactor-sync-delay' plus +;; eventually some delay on top (this addon-delay must be realized with +;; `ecb-run-with-timer'). Hmm, i think i have to make some brainstorming what +;; is the better approach! +(defmacro defecb-interactor-synchronizer (synchronizer + buffer-name-symbol + docstring &rest body) + "Define a creator-function CREATOR for a tree-buffer which name is hold in +the symbol TREE-BUFFER-NAME-SYMBOL. Do not quote CREATOR and +TREE-BUFFER-NAME-SYMBOL. DOCSTRING is the docstring for CREATOR. BODY is all +the program-code of CREATOR \(must contain a call to `tree-buffer-create'). It +makes sense that BODY returns the created tree-buffer. + +When creating a tree-buffer with this macro then this tree-buffer will be +automatically created \(i.e. its creator-function defined with this macro will +be called) when activating ECB and the tree-buffer will automatically +registered at ECB. This means that some features of ECB will work +automatically out of the box with this tree-buffer. + +When creating a tree-buffer for ECB then it MUST be created with this macro +and not with `tree-buffer-create'!" + `(eval-and-compile + (ecb-interactor-synchronizer-register (quote ,buffer-name-symbol) + (quote ,synchronizer)) + (defun ,synchronizer () + ,docstring + (interactive) + (ecb-do-if-buffer-visible-in-ecb-frame (quote ,buffer-name-symbol) + ,@body)))) + +;; (insert (pp (macroexpand +;; '(defecb-interactor-synchronizer ecb-analyse-buffer-sync-test +;; ecb-analyse-buffer-name +;; "testdoctsirng" +;; (let ((analysis nil) +;; (completions nil) +;; (fnargs nil) +;; (cnt nil) +;; ) +;; ;; Try and get some sort of analysis +;; (ignore-errors +;; (save-excursion +;; (setq analysis (ecb--semantic-analyze-current-context (point))) +;; (setq cnt (ecb--semantic-find-tag-by-overlay)) +;; (when analysis +;; (setq completions (ecb--semantic-analyze-possible-completions analysis)) +;; (setq fnargs (ecb--semantic-get-local-arguments (point))) +;; ))) +;; (ecb-exec-in-window ecb-analyse-buffer-name +;; ;; we must remove the old nodes +;; (tree-buffer-set-root (tree-node-new-root)) +;; (when analysis +;; ;; Now insert information about the context +;; (when cnt +;; (ecb-analyse-add-nodes "Context" "Context" +;; cnt ecb-analyse-nodetype-context)) +;; (when fnargs +;; (ecb-analyse-add-nodes "Arguments" "Arguments" fnargs +;; ecb-analyse-nodetype-arguments)) +;; ;; Let different classes draw more nodes. +;; (ecb-analyse-more-nodes analysis) +;; (when completions +;; (ecb-analyse-add-nodes "Completions" "Completions" completions +;; ecb-analyse-nodetype-completions))) +;; (tree-buffer-update))))))) + +;; -- end of interactors synchronizers (defun ecb-format-bucket-name (name) "Format NAME as a bucket-name according to `ecb-bucket-node-display'." @@ -1177,13 +1277,17 @@ be done by any code and must be done via `ecb-stealthy-function-state-init'!" Each function returns 'done if it completes successfully, or something else if interrupted by the user \(i.e. the function has been interrupted by the user). If a function is interrupted then `ecb-stealthy-function-list' is -rotated so the interrupted function is the first element so the nect stealthy +rotated so the interrupted function is the first element so the next stealthy run starts with this interrupted function." (ecb-debug-autocontrol-fcn-error 'ecb-stealthy-updates "Begin: Cur-buf: %s" (current-buffer)) (unless ecb-stealthy-update-running (let ((l ecb-stealthy-function-list) - (ecb-stealthy-update-running t)) + (ecb-stealthy-update-running t) + ;; necessary because timers set this locally to t to prevent + ;; timer-actions from being quitted by C-g. Our potentially long + ;; lasting actions must be quit-able! + (inhibit-quit nil)) (while (and l (equal 'done (funcall (car l)))) (setq l (cdr l))) ;; if l is nil this means all functions have successfully completed - diff --git a/ecb-file-browser.el b/ecb-file-browser.el index f1cb64fa..f245bd17 100644 --- a/ecb-file-browser.el +++ b/ecb-file-browser.el @@ -50,6 +50,7 @@ (silentcomp-defun ecb-speedbar-update-contents) (silentcomp-defvar vc-cvs-stay-local) +(silentcomp-defvar dired-directory) ;;==================================================== ;; Customization @@ -425,6 +426,41 @@ The check is performed according to the settings in the options (not (ecb-remote-path dir)))) (not (ecb-match-regexp-list dir ecb-prescan-directories-exclude-regexps)))) +(defcustom ecb-grep-function (if (fboundp 'igrep) 'igrep 'grep) + "*Function used for performing a grep. +The popup-menu of the tree-buffers \"Directories\", \"Sources\" and +\"History\" offer to grep the \"current\" directory: +- Directory-buffer: The grep is performed in the current popup-directory after + clicking the right mouse-button onto a node. +- Sources-buffer: The grep is performed in the current selected directory. +- History-buffer: The grep is performed in the directory of the current + popup-source after clicking the right mouse-button onto a node. + +Conditions for such a function: +- The function is called interactively via `call-interactively' +- During the function-call the `default-directory' is temp. set to that + directory mentioned above with \"... is performed in ...\", i.e. the + function can use the value of `default-directory' to determine the directory + to grep. +- The function must read all it's arguments itself. +- The function is completely responsible for performing the grep itself and + displaying the results. + +Normally one of the standard-grepping functions like `grep' or `igrep' \(or +some wrappers around it) should be used!" + :group 'ecb-directories + :group 'ecb-sources + :type 'function) + +(defcustom ecb-grep-find-function (if (fboundp 'igrep-find) + 'igrep-find 'grep-find) + "*Function used for performing a recursive grep. +For more Details see option `ecb-grep-function' and replace \"grep\" with +\"recursive grep\" or \"grep-find\"." + :group 'ecb-directories + :group 'ecb-sources + :type 'function) + (defcustom ecb-after-directory-change-hook nil "*Hook which run directly after the selected directory has changed. This means not onyl after a click onto a directory in the directory-window of @@ -1559,6 +1595,99 @@ ECB-history-window is not visible in current layout." (switch-to-buffer ecb-history-buffer-name)) +(defun ecb-directories-sources-history-buffer-sync (&optional force) + "Synchronizing the basic tree-buffers of ECB. + +Under the following additional conditions some tasks are performed: + +- Current buffer is a file-buffer and either FORCE is not nil or the buffer + is different from the source-file currently displayed in the + ECB-tree-buffers: + + Synchronizing all tree-buffers with the current buffer + +- Current buffer is a dired-buffer: + + Synchronizing the directory- and sources-tree-buffer if visible" + (let ((filename (buffer-file-name (current-buffer)))) + (cond ( ;; synchronizing for real filesource-buffers + (and filename + (ecb-buffer-or-file-readable-p) + (or force + (not (ecb-string= filename ecb-path-selected-source)))) + + ;; * KB: Problem: seems this little sleep is necessary because + ;; otherwise jumping to certain markers in new opened files (e.g. + ;; with next-error etc. ) doesn´t work correct. Can´t debug down + ;; this mysterious thing! Regardless of the size of the file to + ;; load, this 0.1 fraction of a sec is enough! + ;; * KB: With current ECB implementation this sit-for seems not + ;; longer necessary, it works with every Emacs version correct. + ;; Therefore i comment out the sit-for until this error occurs + ;; again. + ;; (sit-for 0.1) + + ;; if the file is not located in any of the paths in + ;; `ecb-source-path' or in the paths returned from + ;; `ecb-source-path-functions' we must at least add the new + ;; source path temporally to our paths. But the user has also + ;; the choice to save it for future sessions too. + (if (null (ecb-matching-source-paths filename)) + (let* ((norm-filename (ecb-fix-filename filename)) + (remote-path (ecb-remote-path norm-filename)) + (source-path (if (car ecb-add-path-for-not-matching-files) + ;; we always add the only the root + ;; as source-path + (if remote-path + ;; for a remote-path we add the + ;; host+ the root of the host + (concat (car remote-path) "/") + ;; filename is a local-path + (if (= (aref norm-filename 0) ?/) + ;; for Unix-style-path we add the + ;; root-dir + (substring norm-filename 0 1) + ;; for win32-style-path we add + ;; the drive; because + ;; `ecb-fix-filename' also + ;; converts cygwin-path-style + ;; to win32-path-style here + ;; also the drive is added. + (substring norm-filename 0 2))) + ;; add the full directory as source-path + (ecb-file-name-directory norm-filename)))) + (ecb-add-source-path source-path (ecb-fix-filename source-path) + (not (cdr ecb-add-path-for-not-matching-files))))) + + ;; now we can be sure that a matching source-path exists + + ;; Klaus: The explicit update of the directories buffer is not + ;; necessary because the sync with the current source is done by + ;; `ecb-select-source-file'! + ;; (ecb-update-directories-buffer) + (ecb-select-source-file filename force) + (ecb-update-methods-buffer--internal 'scroll-to-begin) + (setq ecb-major-mode-selected-source major-mode) + + ;; Klaus Berndl : is now be done at the + ;; end of `ecb-rebuild-methods-buffer-with-tagcache' which is + ;; called by `ecb-update-methods-buffer--internal'! + + ;; selected source has changed, therefore we must initialize + ;; ecb-selected-tag again. + (ecb-tag-sync 'force) + ) + + ( ;; synchronizing for dired-mode + (eq major-mode 'dired-mode) + (ecb-set-selected-directory + (or (and (stringp dired-directory) + (ecb-file-exists-p dired-directory) + dired-directory) + (and (listp dired-directory) + (car dired-directory))))) + (t nil)))) + (defun ecb-expand-directory-tree (path node) "Expands the directory part so the node representing PATH is visible. Start with the childrens of NODE. Return not nil when an expansion has been diff --git a/ecb-method-browser.el b/ecb-method-browser.el index 281afb54..54e805bf 100644 --- a/ecb-method-browser.el +++ b/ecb-method-browser.el @@ -1188,7 +1188,7 @@ check the result if `ecb-debug-mode' is nil in which case the function ;; 1. After every jump to a tag X via the method-buffer of ;; ECB this tag X is added to the navigation history list ;; as new ecb-nav-tag-history-item. - ;; 2. Before every select of a source in the sources- or + ;; 2. Before any select of a source in the sources- or ;; history-buffer or of a node in the method-buffer ;; `ecb-nav-save-current' is called which operates onto ;; the last saved history-item which is often a @@ -2819,7 +2819,7 @@ to be rescanned/reparsed and therefore the Method-buffer will be rebuild too." (if (equal non-semantic-handling 'parsed) (ecb-create-non-semantic-tree new-tree updated-cache)) (ecb-add-tags new-tree - (ecb-post-process-taglist updated-cache))) + (ecb-post-process-taglist updated-cache))) (if cache (setcdr cache new-tree) (setq cache (cons norm-buffer-file-name new-tree)) @@ -3514,12 +3514,48 @@ should be displayed. For 1 and 2 the value of EDIT-WINDOW-NR is ignored." ;; Try to find source using JDE (setq found (ecb-jde-show-class-source data)) ;; Fix from Daniel Dbertin () + ;; works for code like this: + ;; namespace moose { + ;; class fee { + ;; int fi; + ;; }; + ;; + ;; class fie : public fee { + ;; int fi; + ;; }; + ;; } + ;; + ;; but not for code like this: + ;; + ;; namespace moose { + ;; class fee { + ;; int fi; + ;; }; + ;; + ;; class fie : public fee { + ;; int fi; + ;; }; + ;; } + ;; + ;; namespace meese { + ;; class fee { + ;; int fi; + ;; }; + ;; + ;; class fey : public fee { + ;; int fi; + ;; }; + ;; } + ;; + ;; In the latter example `semantic-ctxt-scoped-types' returns both + ;; namespace-tag-tables and not only the right one! ;; TODO: Klaus Berndl : encapsulate these function ;; with ecb-- wrappers! - (let ((types (semantic-ctxt-scoped-types))) - (setq tag (and types (car (semantic-deep-find-tags-by-name data types)))) - (if tag - (setq filename (semantic-tag-file-name tag)))) + ;; TODO: Klaus Berndl : Make this code save - e.g. + ;; what about getting more than one tag with that name? +;; (let ((types (semantic-ctxt-scoped-types))) +;; (setq tag (and types (car (semantic-deep-find-tags-by-name data types)))) +;; (if tag (setq filename (semantic-tag-file-name tag)))) ;; Try to find source using Semantic DB (when (and (null tag) (not found)) (let ((parent (ecb-semanticdb-get-type-definition data))) diff --git a/ecb-semantic-wrapper.el b/ecb-semantic-wrapper.el index ce708868..2001f0f6 100644 --- a/ecb-semantic-wrapper.el +++ b/ecb-semantic-wrapper.el @@ -176,9 +176,6 @@ function of `semantic-token->text-functions' (rsp. for semantic 2.X (defconst ecb--semanticdb-function-alist '((semanticdb-minor-mode-p . semanticdb-minor-mode-p) - ;; This is not a full compatible alias. Only the first two parameters can - ;; be used with this alias! - (semanticdb-find-nonterminal-by-name . semanticdb-find-tags-by-name) (semanticdb-full-filename . semanticdb-full-filename)) "Alist where the car is a function of semanticdb 1.X and the cdr is the equivalent new function of semanticdb 2.X. This alist should contain every @@ -318,6 +315,31 @@ unmodified as components of their parent tags." ;; Once you have a search result, use these routines to operate ;; on the search results at a higher level +(if (fboundp 'semanticdb-find-tags-by-name) + (defalias 'ecb--semanticdb-find-tags-by-name + 'semanticdb-find-tags-by-name) + (defun ecb--semanticdb-find-tags-by-name (name &optional path find-file-match) + "Runs `semanticdb-find-nonterminal-by-name' with SEARCH-PARTS is nil." + (apply 'semanticdb-find-nonterminal-by-name + (list name path nil nil nil find-file-match)))) + +(if (fboundp 'semanticdb-deep-find-tags-by-name) + (defalias 'ecb--semanticdb-deep-find-tags-by-name + 'semanticdb-deep-find-tags-by-name) + (defun ecb--semanticdb-deep-find-tags-by-name (name &optional path find-file-match) + "Runs `semanticdb-find-nonterminal-by-name' with SEARCH-PARTS is t." + (apply 'semanticdb-find-nonterminal-by-name + (list name path t nil nil find-file-match)))) + +(if (fboundp 'semanticdb-brute-deep-find-tags-by-name) + (defalias 'ecb--semanticdb-brute-deep-find-tags-by-name + 'semanticdb-brute-deep-find-tags-by-name) + (defun ecb--semanticdb-brute-deep-find-tags-by-name (name &optional + path find-file-match) + "In semantic 1.4 all searches are brutish, so it runs just + `semanticdb-find-nonterminal-by-name' with SEARCH-PARTS is t." + (ecb--semanticdb-deep-find-tags-by-name name path find-file-match))) + (if (fboundp 'semanticdb-strip-find-results) (defalias 'ecb--semanticdb-strip-find-results diff --git a/ecb-symboldef.el b/ecb-symboldef.el index cf5835ca..2f4cdb55 100644 --- a/ecb-symboldef.el +++ b/ecb-symboldef.el @@ -1,386 +1,385 @@ -;;; ecb-symboldef.el --- ECB displayor for symbol-definitions - -;;; Copyright (C) 2005 Hauke Jans - -;; Author: Hauke Jans, , -;; Maintainer: Hauke Jans, , -;; Klaus Berndl -;; Keywords: browser, code, programming, symbol-definition -;; Created: 2005 - -;; This program is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 2, or (at your option) any later -;; version. - -;; This program is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -;; more details. - -;; You should have received a copy of the GNU General Public License along -;; with GNU Emacs; see the file COPYING. If not, write to the Free Software -;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -;; $Id$ - -;;; Commentary: -;; -;; Define an ecb-buffer which shows in a special ecb buffer the semantic -;; context of the definition of a current symbol under point. -;; - -;;; Usage -;; -;; Either use the layout "left-symboldef" (e.g. via [C-c . l c]) or create a -;; new ecb-layout via the command `ecb-create-new-layout' and add a buffer of -;; type "other" and name "symboldef" into this new layout. - -;;; History -;; -;; For the ChangeLog of this file see the CVS-repository. For a complete -;; history of the ECB-package see the file NEWS. - -;;; Code: - - -(require 'ecb-util) -(require 'ecb-layout) -(require 'ecb-common-browser) - -(eval-when-compile - (require 'silentcomp)) - -;; XEmacs-stuff -(silentcomp-defun function-arglist) -(silentcomp-defun function-documentation) -(silentcomp-defun find-tag-internal) -;; Emacs stuff -(silentcomp-defun find-tag-noselect) - -;; TODO: Klaus Berndl : -;; 1. Add all necessary documentation to the info-manual (texi) -;; 2. Add this preferences group to the menu in ecb.el -(defgroup ecb-symboldef nil - "Settings for the symbol-definition-buffer in the Emacs code browser." - :group 'ecb - :prefix "ecb-") - -(defcustom ecb-symboldef-buffer-name " *ECB Symboldefinition*" - "*Name of the ECB-symbol-definition buffer. -Because it is not a normal buffer for editing you should enclose the name with -stars, e.g. \"*ECB Symboldefinition*\". - -If it is necessary for you you can get emacs-lisp access to the buffer-object -of the ECB-symbol-definition-buffer by this name, e.g. by a call of -`set-buffer'. - -Changes for this option at runtime will take affect only after deactivating and -then activating ECB again!" - :group 'ecb-symboldef - :type 'string) - -(defcustom ecb-symboldef-find-functions - '((lisp-interaction-mode . ecb-symboldef-find-lisp-doc) - (lisp-mode . ecb-symboldef-find-lisp-doc) - (emacs-lisp-mode . ecb-symboldef-find-lisp-doc) - (default . ecb-symboldef-find-definition)) - "*Funtions to find the definition for current symbol under point. -This functionality is set on a major-mode base, i.e. for every major-mode a -different setting can be used. The value of this option is a list of -cons-cells: -- The car is either a major-mode symbol or the special symbol 'default which - means if no setting for a certain major-mode is defined then the cdr of - the 'default cons-cell is used. -- The car is a function intended to find the definition of a certain symbol - for files of this major-mode. Such a function will be called with two - arguments, the first is the symbol-name as string for which the definition - should be displayed and the second the current edit-buffer as buffer-object, - i.e. the current buffer of the current edit-window. The function will be - called with the special ecb-symbol-definition-buffer as current buffer - whereas this buffer is empty. The function has to insert everything - necessary to display the symbol-definition and is also responsible to format - the displayed text. The buffer-local variable `fill-column is already preset - to the window-width of the special ecb-window minus 1. The function is - responsible to set the buffer-local variable `truncate-lines' appropriate. - The function can either return nil or a string which will be integrated in - the modeline-display of this ecb-window. - -There are two prefined functions `ecb-symboldef-find-lisp-doc' and -`ecb-symboldef-find-definition' whereas the latter on is used a default -find-function." - :group 'ecb-symboldef - :type '(repeat (cons (symbol :tag "Major-mode") - (function :tag "Find function")))) - -;; TODO: Klaus Berndl : This option is an example how the -;; user could determine which backends should be used for finding a definition -;; and also in which order the backends should be tried... -(defcustom ecb-symboldef-find-backends '(semanticdb etags) - "*" - :group 'ecb-symboldef - :type '(repeat (choice :tag "Backends" - :menu-tag "Backends" - (const :tag "semanticdb" :value semanticdb) - (const :tag "etags" :value etags) - (symbol :tag "Other")))) - -;; ---- internal variables ----------- - -(defvar ecb-symboldef-last-symbol nil - "Holds the previous symbol under cursor") - -(defun ecb-symboldef-get-find-function () - "Returns the symbol find function to use according to major-mode" - (let ((mode-function (cdr (assoc major-mode ecb-symboldef-find-functions))) - (default-function (cdr (assoc 'default ecb-symboldef-find-functions)))) - (or mode-function - default-function - 'ecb-symboldef-find-null))) - -(defun ecb-symboldef-find-null (symbol-name edit-buffer) - "Empty symbol-definition find function. -Only prints mode and info but does not find any symbol-definition." - (let ((symboldef-window-height (ecb-window-full-height - (get-buffer-window (current-buffer))))) - (dotimes (i (/ symboldef-window-height 2)) (insert "\n")) - (insert "* No symbol definition function for current mode *\n" - "* See variable `ecb-symboldef-find-functions' *"))) - -(defun ecb-symboldef-get-elisp-arglist (function) - "Return the argument-list of FUNCTION as a string in the format: -\(FUNCTION ARG1 ARG2...ARGn)." - (if ecb-running-xemacs - ;; XEmacs does not return an arglist for builtins (test by subrp)! So if - ;; the documentation itself does not contain the arglist there is no way - ;; to get it (e.g. call C-h f for `append', `list'...). - (function-arglist function) - ;; GNU Emacs - mechanism stolen from `describe-function-1'... - (let (;; resolve alias-chains - (def (indirect-function function)) - (arglist nil)) - ;; If def is a macro, find the function inside it. - (if (eq (car-safe def) 'macro) - (setq def (cdr def))) - (setq arglist (cond ((byte-code-function-p def) - (car (append def nil))) - ((eq (car-safe def) 'lambda) - (nth 1 def)) - ((and (eq (car-safe def) 'autoload) - (not (eq (nth 4 def) 'keymap))) - (concat "[Arg list not available until " - "function definition is loaded.]")) - (t t))) - (cond ((listp arglist) - (prin1-to-string - (cons (if (symbolp function) function "anonymous") - (mapcar (lambda (arg) - (if (memq arg '(&optional &rest)) - arg - (intern (upcase (symbol-name arg))))) - arglist)))) - ((stringp arglist) - (format "(%s %s)" function arglist)))))) - -(defun ecb-symboldef-find-lisp-doc (symbol-name edit-buffer) - "Insert the lisp-documentation of symbol with name SYMBOL-NAME." - (setq truncate-lines nil) - (let ((symbol (intern symbol-name)) - (retval nil) - (args nil)) - (when (fboundp symbol) - (insert (format "%s\t%s\n\n" symbol - (if (commandp symbol) - (let ((keys (where-is-internal symbol))) - (if keys - (concat - "is a command with keys: " - (mapconcat 'key-description - keys ", ")) - "is a command with no keys")) - "is a function"))) - (insert (format "%s\n\n" (or (documentation symbol) - "Not documented"))) - (setq args (ecb-symboldef-get-elisp-arglist symbol)) - ;; KB: We display the arglist AFTER the documentation because in GNU - ;; Emacs the documentation of subr's (test by subrp) contains the - ;; arglist at the end of the documentation so we display it at the same - ;; place for all other functions. The internal help of GNU Emacs has an - ;; ugly hack for its function-help (see `describe-function-1' in - ;; help.el) which searches for the arglist of subr's in the docu, - ;; removes it from the end and inserts it again at beginning of the - ;; documentation. I'm to lazy to do the same here because it's a clumsy - ;; hack...but if you want the arglist in front of the docu-text you have - ;; to do this here too (how to do it can be seen in - ;; `describe-function-1'). - (and args (insert (format "%s\n\n" args))) - (setq retval (format "Lisp %s" - (if (commandp symbol) - "Command" - "Function")))) - (when (boundp symbol) - (insert (format "%s\t%s\n\n%s\n\nValue: %s\n\n" symbol - (if (user-variable-p symbol) - "Option " "Variable") - (or (documentation-property - symbol 'variable-documentation) - "not documented") - (symbol-value symbol))) - (setq retval "Lisp Variable")) - (fill-region (point-min) (point-max) 'left) - retval)) - -;; TODO: Klaus Berndl : Replace the semantic-calls with -;; ecb--* wrappers -(defun ecb-symboldef-find-tag-by-semanticdb (symbol-name edit-buffer) - "Function to find a semantic-tag by SYMBOL-NAME. -Returns nil if not found otherwise a list \(tag-buffer tag-begin tag-end)" - (save-excursion - (set-buffer edit-buffer) - (let* ((mytag-list (semanticdb-brute-deep-find-tags-by-name symbol-name - nil t)) - (mytag (if mytag-list - (car (semanticdb-find-result-nth - mytag-list - (1- (semanticdb-find-result-length mytag-list)))))) - (mytag-ovr (if mytag (semantic-tag-bounds mytag))) - (mytag-min (if mytag-ovr (car mytag-ovr))) - (mytag-max (if mytag-ovr (car (cdr mytag-ovr)))) - (mytag-buf (if mytag (semantic-tag-buffer mytag)))) - (if mytag-buf - (list mytag-buf mytag-min mytag-max))))) - -(defun ecb-symboldef-find-tag-by-etags (symbol-name edit-buffer) - "Try to find the definition of SYMBOL-NAME via etags. -Returns nil if not found otherwise a list \(tag-buffer tag-begin tag-end) -whereas tag-end is currently always nil." - (if ecb-running-xemacs - (let ((result (ignore-errors (find-tag-internal (list symbol-name))))) - (if result - (list (car result) (cdr result) nil))) - ;; else gnu emacs: - (let* ((result-buf (ignore-errors (find-tag-noselect symbol-name))) - (result-point (if result-buf - (with-current-buffer result-buf - (point))))) - (if result-buf - (list result-buf result-point nil))))) - -(defun ecb-symboldef-find-definition (symbol-name edit-buffer) - "Inserts the definition of symbol with name SYMBOL-NAME. -Fill the upper-half of the special ecb-window with text preceding the -symbol-definition in the definition-file. First tries to find the definition -with semanticdb and then - if no success - with current etags-file." - (let* ((symboldef-window-height (ecb-window-full-height - (get-buffer-window (current-buffer)))) - ;; first lookup via semnaticdb, then via etags: - (result (or (ecb-symboldef-find-tag-by-semanticdb symbol-name edit-buffer) - (ecb-symboldef-find-tag-by-etags symbol-name edit-buffer) - (list nil nil nil))) - (num-tag-lines (- (/ symboldef-window-height 2) 0)) - (tag-buf (nth 0 result)) - (tag-point (nth 1 result)) - (tag-point-max (nth 2 result)) - (extend-point-min nil) - (extend-point-max nil) - (hilight-point-min nil) - (hilight-point-max nil)) - (setq truncate-lines t) - (when tag-buf - (save-excursion - (set-buffer tag-buf) - (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 (ecb-buffer-substring extend-point-min extend-point-max tag-buf)) - (goto-char (+ (- tag-point extend-point-min) 1)) - (setq hilight-point-min (point)) - (if tag-point-max - (goto-char (+ (- tag-point-max extend-point-min) 1)) - (end-of-line)) - (setq hilight-point-max (point)) - (add-text-properties hilight-point-min hilight-point-max - '(face highlight )) - ;; return value - (buffer-name tag-buf)))) - -;; buffer update function: -(defun ecb-symboldef-update (edit-buffer symboldef-buffer symboldef-window) - "Runs the finder of `ecb-symboldef-find-functions' for current symbol. -Displays the found text in the buffer SYMBOLDEF-BUFFER which is displayed in -window SYMBOLDEF-WINDOW. EDIT-BUFFER is the current buffer of the current -edit-window." - (let ((modeline-display nil) - (current-symbol - ;; check if point is not at start, since - ;; buggy thingatpt yields error then: - ;; TODO: Klaus Berndl : i can not believe this - (if (> (point) (point-min)) - (ecb-thing-at-point 'symbol) - nil)) - ;; find tag search function according to mode: - (find-func (ecb-symboldef-get-find-function))) - ;; TODO: Klaus Berndl : make an option for this - ;; min-length - ;; only use tags with a minimal length: - (setq current-symbol (if (> (length current-symbol) 3) - current-symbol)) - ;; buggy thingatpt returns whole buffer if on empty line: - (setq current-symbol (if (< (length current-symbol) 80) - current-symbol)) - ;; research tag only if different from last and not empty: - (when (and current-symbol - (not (equal current-symbol ecb-symboldef-last-symbol))) - (ecb-with-readonly-buffer symboldef-buffer - (setq ecb-symboldef-last-symbol current-symbol) - (erase-buffer) - (setq fill-column (1- (window-width symboldef-window))) - (setq modeline-display - (or (funcall find-func - current-symbol - edit-buffer) - "")) - ;; TODO: Klaus Berndl : replace this by - ;; a ecb-mode-line-format - if possible?! - (ecb-mode-line-set (buffer-name symboldef-buffer) - (selected-frame) - (format "* Def %s <<%s>> *" - modeline-display current-symbol) - nil t) - )))) - -(defecb-window-dedicator ecb-set-symboldef-buffer - (buffer-name (get-buffer-create ecb-symboldef-buffer-name)) - "Set the buffer in the current window to the tag-definition-buffer and make -this window dedicated for this buffer." - (switch-to-buffer (get-buffer-create ecb-symboldef-buffer-name)) - (add-hook 'ecb-current-buffer-sync-hook 'ecb-symboldef-sync)) - -(defun ecb-symboldef-sync () - "Synchronizes the symbol-definition 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-symboldef-buffer-name - (save-excursion - (ecb-symboldef-update (current-buffer) visible-buffer visible-window)))) - -(defun ecb-maximize-window-symboldef () - "Maximize the ECB-symbol-defnition window. -I.e. delete all other ECB-windows, so only one ECB-window and the -edit-window\(s) are visible \(and maybe a compile-window). Works also if the -ECB-symboldefinition-window is not visible in current layout." - (interactive) - (ecb-maximize-ecb-buffer ecb-symboldef-buffer-name t)) - -(defun ecb-goto-window-symboldef () - "Make the ECB-symbol-definition window the current window." - (interactive) - (ecb-goto-ecb-window ecb-symboldef-buffer-name)) - -(silentcomp-provide 'ecb-symboldef) - -;;; ecb-symboldef.el ends here +;;; ecb-symboldef.el --- ECB displayor for symbol-definitions + +;;; Copyright (C) 2005 Hauke Jans + +;; Author: Hauke Jans, , +;; Maintainer: Hauke Jans, , +;; Klaus Berndl +;; Keywords: browser, code, programming, symbol-definition +;; Created: 2005 + +;; This program is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 2, or (at your option) any later +;; version. + +;; This program is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +;; more details. + +;; You should have received a copy of the GNU General Public License along +;; with GNU Emacs; see the file COPYING. If not, write to the Free Software +;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +;; $Id$ + +;;; Commentary: +;; +;; Define an ecb-buffer which shows in a special ecb buffer the semantic +;; context of the definition of a current symbol under point. +;; + +;;; Usage +;; +;; Either use the layout "left-symboldef" (e.g. via [C-c . l c]) or create a +;; new ecb-layout via the command `ecb-create-new-layout' and add a buffer of +;; type "other" and name "symboldef" into this new layout. + +;;; History +;; +;; For the ChangeLog of this file see the CVS-repository. For a complete +;; history of the ECB-package see the file NEWS. + +;;; Code: + + +(require 'ecb-util) +(require 'ecb-layout) +(require 'ecb-common-browser) +(require 'ecb-semantic-wrapper) + +(eval-when-compile + (require 'silentcomp)) + +;; XEmacs-stuff +(silentcomp-defun function-arglist) +(silentcomp-defun function-documentation) +(silentcomp-defun find-tag-internal) +;; Emacs stuff +(silentcomp-defun find-tag-noselect) + +;; TODO: Klaus Berndl : +;; 1. Add all necessary documentation to the info-manual (texi) +;; 2. Add this preferences group to the menu in ecb.el +(defgroup ecb-symboldef nil + "Settings for the symbol-definition-buffer in the Emacs code browser." + :group 'ecb + :prefix "ecb-") + +(defcustom ecb-symboldef-buffer-name " *ECB Symboldefinition*" + "*Name of the ECB-symbol-definition buffer. +Because it is not a normal buffer for editing you should enclose the name with +stars, e.g. \"*ECB Symboldefinition*\". + +If it is necessary for you you can get emacs-lisp access to the buffer-object +of the ECB-symbol-definition-buffer by this name, e.g. by a call of +`set-buffer'. + +Changes for this option at runtime will take affect only after deactivating and +then activating ECB again!" + :group 'ecb-symboldef + :type 'string) + +(defcustom ecb-symboldef-find-functions + '((lisp-interaction-mode . ecb-symboldef-find-lisp-doc) + (lisp-mode . ecb-symboldef-find-lisp-doc) + (emacs-lisp-mode . ecb-symboldef-find-lisp-doc) + (default . ecb-symboldef-find-definition)) + "*Funtions to find the definition for current symbol under point. +This functionality is set on a major-mode base, i.e. for every major-mode a +different setting can be used. The value of this option is a list of +cons-cells: +- The car is either a major-mode symbol or the special symbol 'default which + means if no setting for a certain major-mode is defined then the cdr of + the 'default cons-cell is used. +- The car is a function intended to find the definition of a certain symbol + for files of this major-mode. Such a function will be called with two + arguments, the first is the symbol-name as string for which the definition + should be displayed and the second the current edit-buffer as buffer-object, + i.e. the current buffer of the current edit-window. The function will be + called with the special ecb-symbol-definition-buffer as current buffer + whereas this buffer is empty. The function has to insert everything + necessary to display the symbol-definition and is also responsible to format + the displayed text. The buffer-local variable `fill-column is already preset + to the window-width of the special ecb-window minus 1. The function is + responsible to set the buffer-local variable `truncate-lines' appropriate. + The function can either return nil or a string which will be integrated in + the modeline-display of this ecb-window. + +There are two prefined functions `ecb-symboldef-find-lisp-doc' and +`ecb-symboldef-find-definition' whereas the latter on is used a default +find-function." + :group 'ecb-symboldef + :type '(repeat (cons (symbol :tag "Major-mode") + (function :tag "Find function")))) + +;; TODO: Klaus Berndl : This option is an example how the +;; user could determine which backends should be used for finding a definition +;; and also in which order the backends should be tried... +(defcustom ecb-symboldef-find-backends '(semanticdb etags) + "*Feature currently not implemented!" + :group 'ecb-symboldef + :type '(repeat (choice :tag "Backends" + :menu-tag "Backends" + (const :tag "semanticdb" :value semanticdb) + (const :tag "etags" :value etags) + (symbol :tag "Other")))) + +;; ---- internal variables ----------- + +(defvar ecb-symboldef-last-symbol nil + "Holds the previous symbol under cursor") + +(defun ecb-symboldef-get-find-function () + "Returns the symbol find function to use according to major-mode" + (let ((mode-function (cdr (assoc major-mode ecb-symboldef-find-functions))) + (default-function (cdr (assoc 'default ecb-symboldef-find-functions)))) + (or mode-function + default-function + 'ecb-symboldef-find-null))) + +(defun ecb-symboldef-find-null (symbol-name edit-buffer) + "Empty symbol-definition find function. +Only prints mode and info but does not find any symbol-definition." + (let ((symboldef-window-height (ecb-window-full-height + (get-buffer-window (current-buffer))))) + (dotimes (i (/ symboldef-window-height 2)) (insert "\n")) + (insert "* No symbol definition function for current mode *\n" + "* See variable `ecb-symboldef-find-functions' *"))) + +(defun ecb-symboldef-get-elisp-arglist (function) + "Return the argument-list of FUNCTION as a string in the format: +\(FUNCTION ARG1 ARG2...ARGn)." + (if ecb-running-xemacs + ;; XEmacs does not return an arglist for builtins (test by subrp)! So if + ;; the documentation itself does not contain the arglist there is no way + ;; to get it (e.g. call C-h f for `append', `list'...). + (function-arglist function) + ;; GNU Emacs - mechanism stolen from `describe-function-1'... + (let (;; resolve alias-chains + (def (indirect-function function)) + (arglist nil)) + ;; If def is a macro, find the function inside it. + (if (eq (car-safe def) 'macro) + (setq def (cdr def))) + (setq arglist (cond ((byte-code-function-p def) + (car (append def nil))) + ((eq (car-safe def) 'lambda) + (nth 1 def)) + ((and (eq (car-safe def) 'autoload) + (not (eq (nth 4 def) 'keymap))) + (concat "[Arg list not available until " + "function definition is loaded.]")) + (t t))) + (cond ((listp arglist) + (prin1-to-string + (cons (if (symbolp function) function "anonymous") + (mapcar (lambda (arg) + (if (memq arg '(&optional &rest)) + arg + (intern (upcase (symbol-name arg))))) + arglist)))) + ((stringp arglist) + (format "(%s %s)" function arglist)))))) + +(defun ecb-symboldef-find-lisp-doc (symbol-name edit-buffer) + "Insert the lisp-documentation of symbol with name SYMBOL-NAME." + (setq truncate-lines nil) + (let ((symbol (intern symbol-name)) + (retval nil) + (args nil)) + (when (fboundp symbol) + (insert (format "%s\t%s\n\n" symbol + (if (commandp symbol) + (let ((keys (where-is-internal symbol))) + (if keys + (concat + "is a command with keys: " + (mapconcat 'key-description + keys ", ")) + "is a command with no keys")) + "is a function"))) + (insert (format "%s\n\n" (or (documentation symbol) + "Not documented"))) + (setq args (ecb-symboldef-get-elisp-arglist symbol)) + ;; KB: We display the arglist AFTER the documentation because in GNU + ;; Emacs the documentation of subr's (test by subrp) contains the + ;; arglist at the end of the documentation so we display it at the same + ;; place for all other functions. The internal help of GNU Emacs has an + ;; ugly hack for its function-help (see `describe-function-1' in + ;; help.el) which searches for the arglist of subr's in the docu, + ;; removes it from the end and inserts it again at beginning of the + ;; documentation. I'm to lazy to do the same here because it's a clumsy + ;; hack...but if you want the arglist in front of the docu-text you have + ;; to do this here too (how to do it can be seen in + ;; `describe-function-1'). + (and args (insert (format "%s\n\n" args))) + (setq retval (format "Lisp %s" + (if (commandp symbol) + "Command" + "Function")))) + (when (boundp symbol) + (insert (format "%s\t%s\n\n%s\n\nValue: %s\n\n" symbol + (if (user-variable-p symbol) + "Option " "Variable") + (or (documentation-property + symbol 'variable-documentation) + "not documented") + (symbol-value symbol))) + (setq retval "Lisp Variable")) + (fill-region (point-min) (point-max) 'left) + retval)) + +(defun ecb-symboldef-find-tag-by-semanticdb (symbol-name edit-buffer) + "Function to find a semantic-tag by SYMBOL-NAME. +Returns nil if not found otherwise a list \(tag-buffer tag-begin tag-end)" + (save-excursion + (set-buffer edit-buffer) + (let* ((mytag-list (ecb--semanticdb-brute-deep-find-tags-by-name symbol-name + nil t)) + (mytag (if mytag-list + (car (ecb--semanticdb-find-result-nth + mytag-list + (1- (ecb--semanticdb-find-result-length mytag-list)))))) + (mytag-ovr (if mytag (semantic-tag-bounds mytag))) + (mytag-min (if mytag-ovr (car mytag-ovr))) + (mytag-max (if mytag-ovr (car (cdr mytag-ovr)))) + (mytag-buf (if mytag (semantic-tag-buffer mytag)))) + (if mytag-buf + (list mytag-buf mytag-min mytag-max))))) + +(defun ecb-symboldef-find-tag-by-etags (symbol-name edit-buffer) + "Try to find the definition of SYMBOL-NAME via etags. +Returns nil if not found otherwise a list \(tag-buffer tag-begin tag-end) +whereas tag-end is currently always nil." + (if ecb-running-xemacs + (let ((result (ignore-errors (find-tag-internal (list symbol-name))))) + (if result + (list (car result) (cdr result) nil))) + ;; else gnu emacs: + (let* ((result-buf (ignore-errors (find-tag-noselect symbol-name))) + (result-point (if result-buf + (with-current-buffer result-buf + (point))))) + (if result-buf + (list result-buf result-point nil))))) + +(defun ecb-symboldef-find-definition (symbol-name edit-buffer) + "Inserts the definition of symbol with name SYMBOL-NAME. +Fill the upper-half of the special ecb-window with text preceding the +symbol-definition in the definition-file. First tries to find the definition +with semanticdb and then - if no success - with current etags-file." + (let* ((symboldef-window-height (ecb-window-full-height + (get-buffer-window (current-buffer)))) + ;; first lookup via semnaticdb, then via etags: + (result (or (ecb-symboldef-find-tag-by-semanticdb symbol-name edit-buffer) + (ecb-symboldef-find-tag-by-etags symbol-name edit-buffer) + (list nil nil nil))) + (num-tag-lines (- (/ symboldef-window-height 2) 0)) + (tag-buf (nth 0 result)) + (tag-point (nth 1 result)) + (tag-point-max (nth 2 result)) + (extend-point-min nil) + (extend-point-max nil) + (hilight-point-min nil) + (hilight-point-max nil)) + (setq truncate-lines t) + (when tag-buf + (save-excursion + (set-buffer tag-buf) + (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 (ecb-buffer-substring extend-point-min extend-point-max tag-buf)) + (goto-char (+ (- tag-point extend-point-min) 1)) + (setq hilight-point-min (point)) + (if tag-point-max + (goto-char (+ (- tag-point-max extend-point-min) 1)) + (end-of-line)) + (setq hilight-point-max (point)) + (add-text-properties hilight-point-min hilight-point-max + '(face highlight )) + ;; return value + (buffer-name tag-buf)))) + +;; buffer update function: +(defun ecb-symboldef-update (edit-buffer symboldef-buffer symboldef-window) + "Runs the finder of `ecb-symboldef-find-functions' for current symbol. +Displays the found text in the buffer SYMBOLDEF-BUFFER which is displayed in +window SYMBOLDEF-WINDOW. EDIT-BUFFER is the current buffer of the current +edit-window." + (let ((modeline-display nil) + (current-symbol + ;; check if point is not at start, since + ;; buggy thingatpt yields error then: + ;; TODO: Klaus Berndl : i can not believe this + (if (> (point) (point-min)) + (ecb-thing-at-point 'symbol) + nil)) + ;; find tag search function according to mode: + (find-func (ecb-symboldef-get-find-function))) + ;; TODO: Klaus Berndl : make an option for this + ;; min-length + ;; only use tags with a minimal length: + (setq current-symbol (if (> (length current-symbol) 3) + current-symbol)) + ;; buggy thingatpt returns whole buffer if on empty line: + (setq current-symbol (if (< (length current-symbol) 80) + current-symbol)) + ;; research tag only if different from last and not empty: + (when (and current-symbol + (not (equal current-symbol ecb-symboldef-last-symbol))) + (ecb-with-readonly-buffer symboldef-buffer + (setq ecb-symboldef-last-symbol current-symbol) + (erase-buffer) + (setq fill-column (1- (window-width symboldef-window))) + (setq modeline-display + (or (funcall find-func + current-symbol + edit-buffer) + "")) + ;; TODO: Klaus Berndl : replace this by + ;; a ecb-mode-line-format - if possible?! + (ecb-mode-line-set (buffer-name symboldef-buffer) + (selected-frame) + (format "* Def %s <<%s>> *" + modeline-display current-symbol) + nil t) + )))) + +(defecb-window-dedicator ecb-set-symboldef-buffer + (buffer-name (get-buffer-create ecb-symboldef-buffer-name)) + "Set the buffer in the current window to the tag-definition-buffer and make +this window dedicated for this buffer." + (switch-to-buffer (get-buffer-create ecb-symboldef-buffer-name)) + (add-hook 'ecb-current-buffer-sync-hook 'ecb-symboldef-sync)) + +(defun ecb-symboldef-sync () + "Synchronizes the symbol-definition 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-symboldef-buffer-name + (save-excursion + (ecb-symboldef-update (current-buffer) visible-buffer visible-window)))) + +(defun ecb-maximize-window-symboldef () + "Maximize the ECB-symbol-defnition window. +I.e. delete all other ECB-windows, so only one ECB-window and the +edit-window\(s) are visible \(and maybe a compile-window). Works also if the +ECB-symboldefinition-window is not visible in current layout." + (interactive) + (ecb-maximize-ecb-buffer ecb-symboldef-buffer-name t)) + +(defun ecb-goto-window-symboldef () + "Make the ECB-symbol-definition window the current window." + (interactive) + (ecb-goto-ecb-window ecb-symboldef-buffer-name)) + +(silentcomp-provide 'ecb-symboldef) + +;;; ecb-symboldef.el ends here diff --git a/ecb-upgrade.el b/ecb-upgrade.el index ef244eba..75245406 100644 --- a/ecb-upgrade.el +++ b/ecb-upgrade.el @@ -159,7 +159,7 @@ ;; IMPORTANT: The version-number is auto-frobbed from the Makefile. Do not ;; change it here! -(defconst ecb-version "2.32beta3" +(defconst ecb-version "2.32" "Current ECB version.") (eval-when-compile @@ -177,7 +177,13 @@ ;; Each NEWS-string should be a one-liner shorter than 70 chars (defconst ecb-upgrade-news - '(("2.30" . ("Support for displaying the VC-state in the tree-buffers; see NEWS." + '(("2.32" . ("New tree-interactor for the semantic-analyser." + "New interactor for displaying definition for current symbol at point." + "Up- and down-arrow are now also smart in the tree-buffers." + "Much better maximizing/minimizing of the ecb-tree-windows." + "New option `ecb-maximize-next-after-maximized-select'." + "`ecb-truncate-lines' has been renamed to `ecb-tree-truncate-lines'")) + ("2.30" . ("Support for displaying the VC-state in the tree-buffers; see NEWS." ;; "ECB is now capable of handling remote paths (e.g. TRAMP-paths)" "Precisely expanding of current node via popup-menu of the methods-buffer." "Time consuming tasks are performed stealthy; see `ecb-stealthy-tasks-delay'")) @@ -300,6 +306,8 @@ ecb-upgrade-tree-image-icons-directories)) (ecb-tree-RET-selects-edit-window . (ecb-tree-do-not-leave-window-after-select ecb-upgrade-tree-RET-selects-edit-window)) + (ecb-download-url . (ecb-download-ecb-url identity)) + (ecb-cedet-url . (ecb-download-cedet-url identity)) ) "Alist of all options which should be upgraded for current ECB-version. There are several reasons why an option should be contained in this alist: @@ -911,18 +919,20 @@ your customization-file!" (erase-buffer)) (if (not (ecb-custom-file-writeable-p)) (progn - (widget-insert "Emacs can not save the upgraded options because the needed file\n") + (widget-insert "Emacs can not save the upgraded incompatible options (s.b.) because that file\n") + (widget-insert "specified for storing all customizations (see documentation of the option\n") + (widget-insert "`custom-file') because the file") (widget-insert (if (ecb-custom-file) (concat (ecb-custom-file) " is not writeable by Emacs!") - "does not exist!")) - (widget-insert "\nPlease ensure that the new values will be stored!\n\n")) + " does either not exist or Emacs has been\nstarted with -q (in the latter case Emacs prevents from writing in the\ncustomizations-file)!\n")) + (widget-insert "\nPlease restart Emacs with a writeable custom- or init-file or without -q\nso the new option-values can be stored!\n\n")) (when (not (get 'ecb-display-upgraded-options 'ecb-upgrades-saved)) - (widget-insert (format "Click on [Save] to save all changed options into %s.\n" + (widget-insert (format "Click on [Save] to save all changed options (s.b.) into %s.\n" (ecb-custom-file))) - (widget-insert (format "This makes a backup of this file unique named with a suffix .before_ecb_%s.\n\n" - ecb-version)))) - (widget-insert "Click on [Cancel] to kill this buffer.\n\n") + (widget-insert (format "This makes a backup of this file uniquely named with a suffix .before_ecb_%s.\n\n" + ecb-version)))) + (widget-insert "Click on [Close] to kill this buffer (do this also after clicking [Save]).\n\n") (when ecb-not-compatible-options (widget-insert "The values of the following options are incompatible with current type.\nECB has tried to transform the old-value to the new type. In cases where\nthis was not possible ECB has reset to the current default-value.") (widget-insert "\n\n")) @@ -1018,7 +1028,7 @@ your customization-file!" :keymap ecb-upgrade-button-keymap ; Emacs :notify (lambda (&rest ignore) (kill-buffer (current-buffer))) - "Cancel") + "Close") (widget-setup) (goto-char (point-min))) t) @@ -1040,16 +1050,18 @@ your customization-file!" ecb-version)) (if (not (ecb-custom-file-writeable-p)) (progn - (widget-insert "Emacs can not save the `ecb-options-version' because the needed file\n") + (widget-insert (format "Emacs can not save the value of `ecb-options-version' (%s) in that file\n" ecb-options-version)) + (widget-insert "specified for storing all customizations (see documentation of the option\n") + (widget-insert "`custom-file') because the file") (widget-insert (if (ecb-custom-file) (concat (ecb-custom-file) " is not writeable by Emacs!") - "does not exist!")) - (widget-insert "\nPlease ensure that `ecb-options-version' will be saved!\n\n")) - (widget-insert (format "Click on [Save] to save `ecb-options-version' into %s.\n" - (ecb-custom-file))) + " does either not exist or Emacs has been\nstarted with -q (in the latter case Emacs prevents from writing in the\ncustomizations-file)!\n")) + (widget-insert "\nPlease restart Emacs with a writeable custom- or init-file or without -q\nso the value of `ecb-options-version' (s.a.) can be stored!\n\n")) + (widget-insert (format "Click on [Save] to save `ecb-options-version' (%s) into %s.\n" + ecb-options-version (ecb-custom-file))) (widget-insert (format "This makes a backup of this file unique named with a suffix .before_ecb_%s.\n\n" ecb-version))) - (widget-insert "Click on [Cancel] to kill this buffer.\n\n") + (widget-insert "Click on [Close] to kill this buffer (do this also after clicking [Save]).\n\n") (widget-insert "For a list of the most important NEWS call `ecb-display-news-for-upgrade'!\n\n") (widget-insert "\n") (when (ecb-custom-file-writeable-p) @@ -1063,13 +1075,13 @@ your customization-file!" (ecb-info-message "ecb-options-version saved!")) "Save") (widget-insert " ")) - ;; Insert the Cancel button + ;; Insert the Close button (widget-create 'push-button :button-keymap ecb-upgrade-button-keymap ; XEmacs :keymap ecb-upgrade-button-keymap ; Emacs :notify (lambda (&rest ignore) (kill-buffer (current-buffer))) - "Cancel") + "Close") (widget-setup) (goto-char (point-min)))) nil)) @@ -1251,13 +1263,13 @@ always true." (setq semantic-state "Correct version already loaded!") (setq semantic-installed-version-str (ecb-package-get-matching-versions-str - "semantic" ecb-cedet-url + "semantic" ecb-packagelist-cedet-url ecb-required-semantic-version-min ecb-required-semantic-version-max)) (setq semantic-dir (ecb-package-download "semantic" semantic-installed-version-str - ecb-cedet-url)) + ecb-download-cedet-url)) (setq semantic-state (if (and semantic-dir semantic-installed-version-str) (concat "Installed " @@ -1270,13 +1282,13 @@ always true." (setq eieio-state "Correct version already loaded!") (setq eieio-installed-version-str (ecb-package-get-matching-versions-str - "eieio" ecb-cedet-url + "eieio" ecb-packagelist-cedet-url ecb-required-eieio-version-min ecb-required-eieio-version-max)) (setq eieio-dir (ecb-package-download "eieio" eieio-installed-version-str - ecb-cedet-url)) + ecb-download-cedet-url)) (setq eieio-state (if (and eieio-dir eieio-installed-version-str) (concat "Installed " @@ -1289,13 +1301,13 @@ always true." (setq speedbar-state "Correct version already loaded!") (setq speedbar-installed-version-str (ecb-package-get-matching-versions-str - "speedbar" ecb-cedet-url + "speedbar" ecb-packagelist-cedet-url ecb-required-speedbar-version-min ecb-required-speedbar-version-max)) (setq speedbar-dir (ecb-package-download "speedbar" speedbar-installed-version-str - ecb-cedet-url)) + ecb-download-cedet-url)) (setq speedbar-state (if (and speedbar-dir speedbar-installed-version-str) (concat "Installed " @@ -1338,7 +1350,17 @@ always true." :group 'ecb :prefix "ecb-") -(defcustom ecb-download-url "http://ftp1.sourceforge.net/ecb/" +(defvar ecb-packagelist-ecb-url "ftp://ftp1.sourceforge.net/pub/sourceforge/e/ec/ecb/" + "Url used to get a list of available versions of ECB. +wget is called with this url so a list of all available files is downloaded +which is parsed by ECB. For the real download see `ecb-download-ecb-url'.") + +(defvar ecb-packagelist-cedet-url "ftp://ftp1.sourceforge.net/pub/sourceforge/c/ce/cedet/" + "Url used to get a list of available versions of CEDET. +wget is called with this url so a list of all available files is downloaded +which is parsed by ECB. For the real download see `ecb-download-cedet-url'.") + +(defcustom ecb-download-ecb-url "http://ftp1.sourceforge.net/ecb/" "*URL where download-able ECB-versions are located. The ECB-archive-file \(e.g. ecb-1.70.tar.gz\) will be appended to this URL and `ecb-download-ecb' will try to download this archive. @@ -1445,7 +1467,7 @@ Possible values are: (const :tag "Always" always) (const :tag "Never" nil))) -(defcustom ecb-cedet-url "http://ftp1.sourceforge.net/cedet/" +(defcustom ecb-download-cedet-url "http://ftp1.sourceforge.net/cedet/" "*URL where download-able CEDET-libraries are located. ECB will try to download \(if necessary) required versions of the libraries needed by ECB: The CEDET libraries semantic, eieio and speedbar. @@ -1653,7 +1675,7 @@ return autom. the newest version-number as version-string." (defun ecb-download-ecb () "Download ECB from the ECB-website and install it. -For this the option `ecb-download-url' must be set correct, whereas the +For this the option `ecb-download-ecb-url' must be set correct, whereas the default value of this option should always be correct. If `ecb-download-package-version-type' is set to -1 \(means asking for a @@ -1677,12 +1699,13 @@ archive available at the ECB website then this function asks for proceeding!" (ecb-package-display-xemacs-package-info "ecb")) (ecb-package-download-ecb/semantic "ecb" ecb-version - ecb-download-url))) + ecb-download-ecb-url + ecb-packagelist-ecb-url))) (defun ecb-download-semantic () "Download semantic from the semantic-website and install it. -For this the variable `ecb-cedet-url' must be set correct, whereas the default -value of this variable should always be correct. +For this the variable `ecb-download-cedet-url' must be set correct, whereas +the default value of this variable should always be correct. If `ecb-download-package-version-type' is set to -1 \(means asking for a version) then you will be ask in the minibuffer for the version to download. @@ -1711,7 +1734,8 @@ proceeding!" (ecb-package-display-xemacs-package-info "semantic")) (ecb-package-download-ecb/semantic "semantic" semantic-version - ecb-cedet-url)))) + ecb-download-cedet-url + ecb-packagelist-cedet-url)))) (defun ecb-package-display-xemacs-package-info (package) "Displays a warning if PACKAGE is a standard xemacs-package and ask if to @@ -1737,11 +1761,13 @@ proceed with downloading. Return not nil if proceeding." "-website? "))) -(defun ecb-package-download-ecb/semantic (package curr-version url) - "Download PACKAGE from URL. CURR-VERSION must be the current version of -current active version of PACKAGE." +(defun ecb-package-download-ecb/semantic (package curr-version download-url + &optional package-list-url) + "Download PACKAGE from DOWNLOAD-URL. CURR-VERSION must be the current +version of current active version of PACKAGE. If PACKAGE-LIST-URL is not nil +then this url is used to get a list of all available versions of PACKAGE." (let ((ver (ecb-package-get-matching-versions-str - package url + package (or package-list-url download-url) (if (= ecb-download-package-version-type -1) '(0 0 0 0) ;; smallest possible version-number (ecb-package-version-str2list curr-version)) @@ -1750,7 +1776,7 @@ current active version of PACKAGE." (if (ecb-string= ver curr-version) (ecb-error "You tried to download an already installed version %s - Stop!" ver)) - (setq install-dir (ecb-package-download package ver url)) + (setq install-dir (ecb-package-download package ver download-url)) (when install-dir (message "New %s successfully installed!" package) (with-output-to-temp-buffer "*ECB downloading and installing*" @@ -2007,8 +2033,8 @@ for details about using \"wget\"." (princ "\n\n") (princ "Please check the wget configuration in \"~/.wgetrc\" and also the value\n") (princ (format "of the option %s." (if (ecb-string= package "ecb") - "`ecb-download-url'" - "`ecb-cedet-url'"))) + "`ecb-download-ecb-url'" + "`ecb-download-cedet-url'"))) (princ " ECB has tried to get informations from\nthe following URL:\n\n") (princ (concat " " package-url)) (princ "\n\n") diff --git a/ecb.el b/ecb.el index 9521f609..e99df5bb 100644 --- a/ecb.el +++ b/ecb.el @@ -230,7 +230,6 @@ is loaded or the value of `semantic-version' at ECB-compilation time.") (silentcomp-defun force-mode-line-update) (silentcomp-defun font-lock-add-keywords) -(silentcomp-defvar dired-directory) (silentcomp-defvar current-menubar) (silentcomp-defun find-menu-item) (silentcomp-defun add-submenu) @@ -333,7 +332,7 @@ used for files- and subdirs \(see `ecb-cache-directory-contents' and `ecb-cache-directory-contents-not') for semantic-tags and for the history-filter. -This caches are completely clean at load-time of the ECB-library! +This caches are completely empty at load-time of the ECB-library! Default is nil, because is makes sense not to clear these caches at start-time because ECB is often deacticated temporally especially in combination with @@ -342,39 +341,6 @@ should be preserved for next activation." :group 'ecb-general :type 'boolean) -(defcustom ecb-grep-function (if (fboundp 'igrep) 'igrep 'grep) - "*Function used for performing a grep. -The popup-menu of the tree-buffers \"Directories\", \"Sources\" and -\"History\" offer to grep the \"current\" directory: -- Directory-buffer: The grep is performed in the current popup-directory after - clicking the right mouse-button onto a node. -- Sources-buffer: The grep is performed in the current selected directory. -- History-buffer: The grep is performed in the directory of the current - popup-source after clicking the right mouse-button onto a node. - -Conditions for such a function: -- The function is called interactively via `call-interactively' -- During the function-call the `default-directory' is temp. set to that - directory mentioned above with \"... is performed in ...\", i.e. the - function can use the value of `default-directory' to determine the directory - to grep. -- The function must read all it's arguments itself. -- The function is completely responsible for performing the grep itself and - displaying the results. - -Normally one of the standard-grepping functions like `grep' or `igrep' \(or -some wrappers around it) should be used!" - :group 'ecb-general - :type 'function) - -(defcustom ecb-grep-find-function (if (fboundp 'igrep-find) - 'igrep-find 'grep-find) - "*Function used for performing a recursive grep. -For more Details see option `ecb-grep-function' and replace \"grep\" with -\"recursive grep\" or \"grep-find\"." - :group 'ecb-general - :type 'function) - (defcustom ecb-window-sync '(Info-mode dired-mode) "*Synchronize the ECB-windows automatically with current edit window. @@ -637,109 +603,25 @@ examples how to use this macro!" (when (member curr-buf (ecb-get-current-visible-ecb-buffers)) (ecb-error "Killing an special ECB-buffer is not possible!")))) +;; TODO: Klaus Berndl : Add a force-argument to all +;; sybc-functions (eshell, speedbar, symboldef, analyse...). Make an +;; infrastructure which accepts for each buffer an own timeout (or +;; post-command, like ecb-window-sync!) and a sync-function! Update the +;; docstring (and also texi) of this command! remove the internal-hook, i +;; think we do not need it anymore! (defun ecb-current-buffer-sync (&optional force) "Synchronizes all special ECB-buffers with current buffer. Depending on the contents of current buffer this function performs several synchronizing tasks but only if ECB is active and point stays in an -edit-window. If this is true under the following additional conditions some -tasks are performed: - -- Current buffer is a file-buffer and either FORCE is not nil or the buffer - is different from the source-file currently displayed in the - ECB-tree-buffers: - - Synchronizing all tree-buffers with the current buffer - -- Current buffer is a dired-buffer: - - Synchronizing the directory- and sources-tree-buffer if visible - -- Always: +edit-window. - Running the hooks in `ecb-current-buffer-sync-hook'." +Running the hooks in `ecb-current-buffer-sync-hook'." (when (and ecb-minor-mode (not ecb-windows-hidden) (ecb-point-in-edit-window)) (ignore-errors - (let ((filename (buffer-file-name (current-buffer)))) - (cond (;; synchronizing for real filesource-buffers - (and filename - (ecb-buffer-or-file-readable-p) - (or force - (not (ecb-string= filename ecb-path-selected-source)))) - - ;; * KB: Problem: seems this little sleep is necessary because - ;; otherwise jumping to certain markers in new opened files (e.g. - ;; with next-error etc. ) doesn´t work correct. Can´t debug down - ;; this mysterious thing! Regardless of the size of the file to - ;; load, this 0.1 fraction of a sec is enough! - ;; * KB: With current ECB implementation this sit-for seems not - ;; longer necessary, it works with every Emacs version correct. - ;; Therefore i comment out the sit-for until this error occurs - ;; again. - ;; (sit-for 0.1) - - ;; if the file is not located in any of the paths in - ;; `ecb-source-path' or in the paths returned from - ;; `ecb-source-path-functions' we must at least add the new - ;; source path temporally to our paths. But the user has also - ;; the choice to save it for future sessions too. - (if (null (ecb-matching-source-paths filename)) - (let* ((norm-filename (ecb-fix-filename filename)) - (remote-path (ecb-remote-path norm-filename)) - (source-path (if (car ecb-add-path-for-not-matching-files) - ;; we always add the only the root - ;; as source-path - (if remote-path - ;; for a remote-path we add the - ;; host+ the root of the host - (concat (car remote-path) "/") - ;; filename is a local-path - (if (= (aref norm-filename 0) ?/) - ;; for Unix-style-path we add the - ;; root-dir - (substring norm-filename 0 1) - ;; for win32-style-path we add - ;; the drive; because - ;; `ecb-fix-filename' also - ;; converts cygwin-path-style - ;; to win32-path-style here - ;; also the drive is added. - (substring norm-filename 0 2))) - ;; add the full directory as source-path - (ecb-file-name-directory norm-filename)))) - (ecb-add-source-path source-path (ecb-fix-filename source-path) - (not (cdr ecb-add-path-for-not-matching-files))))) - - ;; now we can be sure that a matching source-path exists - - ;; Klaus: The explicit update of the directories buffer is not - ;; necessary because the sync with the current source is done by - ;; `ecb-select-source-file'! - ;; (ecb-update-directories-buffer) - (ecb-select-source-file filename force) - (ecb-update-methods-buffer--internal 'scroll-to-begin) - (setq ecb-major-mode-selected-source major-mode) - - ;; Klaus Berndl : is now be done at the - ;; end of `ecb-rebuild-methods-buffer-with-tagcache' which is - ;; called by `ecb-update-methods-buffer--internal'! - - ;; selected source has changed, therefore we must initialize - ;; ecb-selected-tag again. - (ecb-tag-sync 'force) - ) - - (;; synchronizing for dired-mode - (eq major-mode 'dired-mode) - (ecb-set-selected-directory - (or (and (stringp dired-directory) - (ecb-file-exists-p dired-directory) - dired-directory) - (and (listp dired-directory) - (car dired-directory))))) - (t nil)))) + (ecb-directories-sources-history-buffer-sync force)) ;; at the end we are running the hooks (run-hooks 'ecb-current-buffer-sync-hook-internal) @@ -782,19 +664,19 @@ effect is that auto-synchronizing is switched off then the current value of the option `ecb-window-sync' is saved so it can be used for the next switch on by this command. See also the option `ecb-window-sync'." (interactive "P") - (let* ((new-value (if (null arg) - (if ecb-window-sync - (progn - (setq ecb-window-sync-old - ecb-window-sync) - nil) - ecb-window-sync-old) - (if (<= (prefix-numeric-value arg) 0) - (progn - (if ecb-window-sync - (setq ecb-window-sync-old ecb-window-sync)) - nil) - (or ecb-window-sync ecb-window-sync-old))))) + (let ((new-value (if (null arg) + (if ecb-window-sync + (progn + (setq ecb-window-sync-old + ecb-window-sync) + nil) + ecb-window-sync-old) + (if (<= (prefix-numeric-value arg) 0) + (progn + (if ecb-window-sync + (setq ecb-window-sync-old ecb-window-sync)) + nil) + (or ecb-window-sync ecb-window-sync-old))))) (setq ecb-window-sync new-value) (message "Automatic synchronizing the ECB-windows is %s \(Value: %s\)." (if new-value "on" "off") diff --git a/ecb.texi b/ecb.texi index 74e6505d..9b55ace6 100644 --- a/ecb.texi +++ b/ecb.texi @@ -46,7 +46,7 @@ @c edit the Makefile to change the version number. mechanism stolen @c from Tramp @macro ecbver{} -2.32beta3 +2.32 @end macro @@ -337,7 +337,7 @@ Supporting Version control systems * Identifying backends:: How ECB identifies the VC-backend of a dir * Checking the state:: How ECB checks the VC-state of a file -* Remote repositories:: What you should now about this +* Remote repositories:: What you should know about this * Refreshing the VC-state:: How to refresh when state changed outside * Adding new backends:: Necessary steps for adding new backends * Known VC-problems:: Currently known problems of the VC-support @@ -814,7 +814,7 @@ takes effect for this feature: @item @code{speedbar-tag-hierarchy-method} @end itemize -Normally there should no need for you to bother with these options, +Normally there should be no need for you to bother with these options, because the default values are suitable for most situations! But if you are not satisfied with the parsing/display results then you can change some of these options. @@ -1576,6 +1576,21 @@ Right clicking with the mouse (or with the keyboard, see @ref{Using popup-menus}) onto a tree-node opens a popup-menu which allows to display additional (if available) informations to the current node. +@subsubsection Interactive commands of the analyser-interactor + +ECB offers the following commands for the analyser-interactor: + +@itemize @minus +@item @code{ecb-analyse-buffer-sync} +@item @code{ecb-goto-window-analyse} +@item @code{ecb-maximize-window-analyse} +@end itemize + +See @ref{Interactive ECB commands} for details about these commands. +But you should not have any need to call +@code{ecb-analyse-buffer-sync} directly because ECB automatically +syncronizes the analyser-interactor with current active edit-buffer. + @c TODO: Ev. adding the interactive commands of ecb-analyse here?! @end itemize @@ -2377,7 +2392,7 @@ result-buffer in another window. This behavior you have also in ECB. If the edit-area is already splitted into at least two edit-windows then the temp-buffer is displayed in another edit-window otherwise the -edit-are will be splitted first into two edit-windows, one above the +edit-area will be splitted first into two edit-windows, one above the other. The variables @code{temp-buffer-max-height} and @code{temp-buffer-resize-mode} (for GNU Emacs) and @code{temp-buffer-shrink-to-fit} (for XEmacs) work also correctly with @@ -2559,7 +2574,7 @@ ECB will only cycle through the edit-windows of ECB or only scroll another edit-window. If the selected window is not an edit-window then all windows are taken into account. -@item The edit-windos and the compile-window are considered +@item The edit-windows and the compile-window are considered Like above but the compile-window will be added to the subset of the edit-windows. @@ -2841,7 +2856,7 @@ after autom. reparsing the buffer via semantic or after manually rebuilding the methods-buffer of ECB. The tag-class @code{type} (classes, interfaces, enumerations etc.) is -divided into several subtypes by semantic. The subtypes are stings +divided into several subtypes by semantic. The subtypes are strings which names exactly if the tag with tag-class @code{type} is a class, an interface, an enumeration, a typedef etc. With the option @code{ecb-type-tag-expansion} you can tell ECB if these type-tags @@ -4343,7 +4358,7 @@ edit-window. The entry of the ``current'' source-file is highlighted. @item ECB-methods: Contains after synchronizing all the tags of the buffer in the current -selected edit-window, i.e. all methods, variables etc... depending of +selected edit-window, i.e. all methods, variables etc... depending on the major-mode. @item ECB-history: @@ -4355,20 +4370,21 @@ edit-window if this buffer is a source-file. This feature can be customized with the option @code{ecb-window-sync}: -If active then the synchronization takes place always a buffer changes -in an edit window or if another edit-window with another buffer will -be selected, if deactivated then never. But you can also set this -option to a list of major-modes and then the sync. will only be done -if the major-mode of the current buffer belongs NOT to this list. +If active then the synchronization takes place whenever a buffer +changes in an edit window or if another edit-window with another +buffer will be selected, if deactivated then never. But you can also +set this option to a list of major-modes and then the sync. will only +be done if the major-mode of the current buffer does NOT belong to +this list. -But in every case the synchronization takes only place if the +But in every case the synchronization only takes place if the major-mode of the current-buffer in the current selected edit-window has a relation to files or directories. Examples for the former one are all programming-language-modes like @code{c++-mode} or @code{java-mode}, @code{Info-mode} too, an example for the latter one is @code{dired-mode}. For all major-modes related to non-file/directory-buffers like @code{help-mode}, -@code{customize-mode} and others never a synchronization will be done! +@code{customize-mode} and others a synchronization will never be done! It's recommended to exclude at least @code{Info-mode} because it makes no sense to synchronize the ECB-windows after calling the Info help. @@ -4381,16 +4397,16 @@ then customizing the option @code{ecb-window-sync} is inefficient and therefore ECB offers the command @code{ecb-toggle-window-sync}. @strong{Please note}: With the command @code{ecb-window-sync} you can -do a manually synchronization if the automatic one is switched off or +do a manual synchronization if the automatic one is switched off or if you just want to do this! @node Stealthy background tasks, Interactive ECB commands, ECB-window synchronizing, Usage of ECB @section Stealthy background-tasks of ECB -ECB performs some tasks stealthy in the background and also +ECB performs some tasks stealthily in the background and also interruptable by the user because these tasks can be time-consuming and could otherwise block ECB. Currently the following tasks are -performed stealthy and in the background by ECB: +performed stealthily and in the background by ECB: @table @asis @item Prescann directories for emptyness @@ -4441,7 +4457,7 @@ Switch off this feature completely. @end itemize In combination with the option @code{ecb-stealthy-tasks-delay} these -three choices allows already adapting the stealthy tasks to most +three choices already allow adapting the stealthy tasks to most needs. But to offer finest granularity for which directories a certain stealthy task should be switched on and for which not ECB offers for every stealthy task an additional option which allows a finer @@ -4459,9 +4475,10 @@ adjustment: @end itemize These options take only effect when the related task is not completely -switched off but then they allow excluding certain directories (or the -sources of directories) from being processed by a certain stealthy -task. +switched off. If this is the case they allow excluding certain +directories (or the sources of directories) from being processed by a +certain stealthy task. + @node Interactive ECB commands, ,Stealthy background tasks, Usage of ECB @section Interactive ECB commands @@ -4488,7 +4505,7 @@ done for a better readable command index. @xref{Command Index}. @deffn Command activate Activates ECB and creates the special buffers for the choosen layout. -For the layout see @code{ecb-layout-name}. This function raises always +For the layout see @code{ecb-layout-name}. This function always raises the ECB-frame if called from another frame. This is the same as calling @code{ecb-minor-mode} with a positive argument. @end deffn @@ -4709,7 +4726,7 @@ Set the expand level of the nodes in the ECB-directories-buffer. For argument LEVEL see @code{ecb-expand-methods-nodes}. Be aware that for deep structured paths and a lot of source-paths this -command can last a long time - depending of machine- and +command can last a long time - depending on machine- and disk-performance. @end deffn @@ -5066,7 +5083,7 @@ an error. @deffn Command show-help &optional format Shows the online help of ECB either in Info or in HTML format -depending of the value of @code{ecb-show-help-format}. If called with +depending on the value of @code{ecb-show-help-format}. If called with prefix argument, i.e. if @var{FORMAT} is not nil then the user is prompted to choose the format of the help (Info or HTML). If an error about not finding the needed help-file occurs please take a look at @@ -5964,7 +5981,7 @@ changes in the edit window, if @code{nil} then never. If a list of major-modes then only if the @code{major-mode} of the new buffer belongs NOT to this list. -But in every case the synchronization takes only place if the +But in every case the synchronization only takes place if the current-buffer in the current active edit-window has a relation to files or directories. Examples for the former one are all programming-language-modes, @code{Info-mode} too, an example for the @@ -6959,13 +6976,12 @@ sourcefile is read-only then it will be displayed with that face set in the option @code{ecb-source-read-only-face}. Because this check can be take some time if files are used via a -mounted net-drive ECB performs this check stealthy (see -@code{ecb-stealthy-tasks-delay}) so normally there should no -performance-decrease or additional waiting-time for the user. But to -get sure this option offers three choices: @code{t}, -@code{unless-remote} and @code{nil}. See -@code{ecb-prescan-directories-for-emptyness} for an explanation for -these three choices. +mounted net-drive ECB performs this check stealthily (see +@code{ecb-stealthy-tasks-delay}) so normally the user should not see a +performance-decrease or additional waiting-time. But to get sure this +option offers three choices: @code{t}, @code{unless-remote} and +@code{nil}. See @code{ecb-prescan-directories-for-emptyness} for an +explanation for these three choices. The option @code{ecb-read-only-check-exclude-regexps} offers are more fine granularity to exclude the sources of certain directories from @@ -9866,7 +9882,7 @@ required packages. With the option @code{ecb-download-package-version-type} you can specify which type of versions (only stable, stable and betas or stable, betas and alphas) you allow to download and install. This option offers also the choice -of asking you for a certain version. Depending of this setting ECB +of asking you for a certain version. Depending on this setting ECB either ask you which version it should download and install or chooses autom. the newest version available which is matching both its min-max-requirements and the setting in @@ -10404,7 +10420,7 @@ accessible-state of a certain host after a customizable time-interval @subsection Excluding remote directories from time-consuming tasks -ECB performs some tasks stealthy and interruptable by the user (see +ECB performs some tasks stealthily and interruptable by the user (see the option @code{ecb-stealthy-tasks-delay} for additional explanations) because these tasks are time-consuming and could otherwise ECB block. Especially for remote directories these special @@ -10471,7 +10487,7 @@ remote repositories. @menu * Identifying backends:: How ECB identifies the VC-backend of a dir * Checking the state:: How ECB checks the VC-state of a file -* Remote repositories:: What you should now about this +* Remote repositories:: What you should know about this * Refreshing the VC-state:: How to refresh when state changed outside * Adding new backends:: Necessary steps for adding new backends * Known VC-problems:: Currently known problems of the VC-support @@ -10492,8 +10508,8 @@ stores not only the backend itself for that directory but also the associated check-state-function defined in @code{ecb-vc-supported-backends} (@pxref{Checking the state}). -You can add arbitrary functions to this options as long they get one -directory-argument and return either nil oder a backend-symbol. Per +You can add arbitrary functions to this options as long as they get one +directory-argument and return either nil or a backend-symbol. Per default ECB offers the following functions to identify the VC-backend CVS, RCS, SCCS or Subversion@footnote{For this the most recent version of the VC-package (incl. the library vc-svn.el) is needed - as @@ -10535,7 +10551,7 @@ Returns always nil if the library vc-svn.el can not be found. @end table -If ECB should support other VC-backends than CVS, RCS, SCCS or +If ECB should support another VC-backend than CVS, RCS, SCCS or Subversion you have to write your own identify-backend-funtion for the used VC-backend (e.g. Clearcase)! @@ -10559,9 +10575,9 @@ stored in the cache for the directory of that file (@pxref{Identifying backends}). You can add any arbitrary functions as check-state-function to -@code{ecb-vc-supported-backends} as long they get one +@code{ecb-vc-supported-backends} as long as they get one filename-argument and return a state-symbol (e.g. @code{up-to-date}. -ECB can understand a certain set of state-values wghich are then +ECB can understand a certain set of state-values which are then mapped to suitable image-icons which will in turn be displayed in front of the filename in the file-browser. Because the values a check-state-function return can differ from that state-values ECB @@ -10580,10 +10596,10 @@ contains a mapping between these values @code{ecb-vc-state} can return and that state-values ECB understands. If ECB should support other VC-backends than CVS, RCS, SCCS and -Subversion (e.g. Clearcase) you should add a that new backend to the +Subversion (e.g. Clearcase) you should add that new backend to the VC-package (see the initial comments of vc.el how to do this) then ECB -will automatically support this new backend. Alternatively it can be -enough if you write your own check-state-function for this backend and +will automatically support that new backend. Alternatively it may be +sufficient if you write your own check-state-function for this backend and add the needed mapping to @code{ecb-vc-state-mapping} if necessary. @subsubsection Getting heuristic state-values or real ones for CVS @@ -10852,7 +10868,7 @@ isn't running it will be started. @item Expands the compilation window when you run commands. So for example it allows you to view the eshell in minimized mode and then when you -run ``ls'' the window automatically expands (but always depending of +run ``ls'' the window automatically expands (but always depending on the output of the command you run). @item @@ -10869,10 +10885,11 @@ Here comes a detailed explanation of these features and how to use it (all these features are only available if you use a persistent compile-window, i.e. if @code{ecb-compile-window-height} is not nil): -You have not to learn a new command for the eshell-start - just call -@code{eshell} (for convenience also bound to @kbd{C-c . e}) and the -eshell will displayed in the compile-window of ECB (if eshell is not -already alive then it will be started automatically). +You do not have to learn a new command for the eshell-start - just +call @code{eshell} (for convenience also bound to @kbd{C-c . e}) and +the eshell will displayed in the compile-window of ECB (if eshell is +not already alive then it will be started automatically). + ECB tries to display the contents of the eshell-buffer as best as possible, means ECB can autom. enlarge and shrink the compile-window @@ -10883,7 +10900,7 @@ autom. but you can also you the standard compile-window enlarging-command of ECB: @code{ecb-toggle-compile-window-height}. ECB tries also to recenter the eshell-buffer as best as possible. -Normally this is done autom but you can do it on demand with the +Normally this is done autom. but you can do it on demand with the command @code{ecb-eshell-recenter}. If option @code{ecb-eshell-synchronize} is true then ECB always @@ -10997,7 +11014,7 @@ Add the following to your .emacs: (ecb-toggle-compile-window -1))))) @end example -This hides the extra compile-window direct after the start of ECB +This hides the extra compile-window directly after the start of ECB because there is no need for a compile-window at this moment. But the hiding will not be done if there is a compile-window and if a ``compile-buffer'' in the sense of @code{ecb-compilation-buffer-p} is @@ -11367,7 +11384,7 @@ public: @end group @end example -Both the constructor and the desctructor of the class +Both the constructor and the destructor of the class ``ClassWithExternals'' are defined in a file @file{ClassWithExternals.cc}: @@ -11403,7 +11420,7 @@ follows: @end group @end example -Both the constructor and the desctructor of the class +Both the constructor and the destructor of the class ``ClassWithExternals'' are grouped under their class-type. ECB now uses semanticdb to jump to the definition of class ``ClassWithExternals'' when you click onto the type-node @@ -11619,6 +11636,11 @@ in an emacs-buffer! Neither creating a tree-buffer nor adding tree-nodes display anything; this just builds the internal tree-structure. +@strong{IMPORTANT}: See @ref{Programming special windows} for details +about programming interactors (special windows) regardless if they +were build as tree or not. There you can find a.o. how to +automatically synchronizing a special window with the current +edit-buffer. @node A new tree-buffer, A new tree-node, Introduction, tree-buffer @subsection How to create a new tree-buffer @@ -12651,10 +12673,11 @@ Here is an example: @node Adviced functions, The layout-engine, tree-buffer, Elisp programming @section How to deal with the adviced window-functions -ECB offers for packages which work during activated ECB three macros -for easy temporally@footnote{I.e. regardless of the settings in -@code{ecb-advice-window-functions}!} using all original-functions, all -adviced functions or only some adviced functions: +ECB offers three macros for packages which work during an activated +ECB. They allow an easy temporally@footnote{I.e. regardless of the +settings in @code{ecb-advice-window-functions}!} usage of either all +original-functions, all adviced functions or only some adviced +functions: @itemize @minus @item @code{ecb-with-original-functions} @@ -12920,6 +12943,10 @@ covers all necessary aspects to be a good example and skeleton for complex tools (like a graphical debugger) which want to use the layout-engine of ECB do display their own information. +@strong{IMPORTANT}: See @ref{tree-buffer} for a full documentation of +the library tree-buffer.el which can be used for programming a new +special window as a tree! + Here comes the example: @subsubsection The outline of the example layout: @@ -13897,7 +13924,7 @@ XXX is called from within an edit-window if the current selected window is not an edit-window. It does nothing if called for another frame as the ecb-frame. -If such an advice solves the problem then please send a not with the +If such an advice solves the problem then please send a note with the solution to the ECB-mailing-list or direct to the ECB-maintainer so the solution can be integrated in the next ECB-release diff --git a/html/ecb-html.el b/html/ecb-html.el index 8da37104..72fa464c 100644 --- a/html/ecb-html.el +++ b/html/ecb-html.el @@ -77,6 +77,11 @@ "List of latest news displayed on the main page.") (setq ecb-latest-news `( + ,(h-sub-section "ECB 2.32 released! (2005-07-11)" + "ECB offers now two new interactors (special ecb-windows): One for the semantic-analyser (of cedet) and one for displaying the definition of current symbol at point. In addition the up- and down-arrow-keys are also smart in the tree-buffers. Much better maximizing and minimizing of the ecb-windows. Support for (X)Emacs < 21 has been officialy removed. Full documentation of the library tree-buffer.el. Some important bug-fixes. " + (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. " + "Click " (h-link "NEWS.html" "here") + " for information about changes in the new version. ") ,(h-sub-section "ECB 2.31 released! (2004-12-10)" "This is mostly a bug-fix-release for native Windows-XEmacs. In addition beta-code for Clearcase-support has been added. It's strongly recommended to install this release when using native Window-XEmacs! " (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. " @@ -87,11 +92,6 @@ (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. " "Click " (h-link "NEWS.html" "here") " for information about changes in the new version. ") - ,(h-sub-section "ECB 2.30 released! (2004-11-26)" - "ECB can now display the version-control state of files in the tree-buffers; state is displayed with new image-icons. ECB is now capable of handling remote paths (e.g. TRAMP-, ANGE-FTP- or EFS-paths). Much better performance because all time consuming tasks (e.g. checking directories for emptyness or checking the VC-state) are performed stealthy. Now the current node in the methods-buffer can be expanded very precisely via new commands in the popup-menu. ECB has now the new upgrade policy \"Never touching the customization-files of a user without asking\". Some bug fixes. " - (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. " - "Click " (h-link "NEWS.html" "here") - " for information about changes in the new version. ") )) (defvar ecb-rest-news nil @@ -99,6 +99,11 @@ `ecb-html-all-news'.") (setq ecb-rest-news `( + ,(h-sub-section "ECB 2.30 released! (2004-11-26)" + "ECB can now display the version-control state of files in the tree-buffers; state is displayed with new image-icons. ECB is now capable of handling remote paths (e.g. TRAMP-, ANGE-FTP- or EFS-paths). Much better performance because all time consuming tasks (e.g. checking directories for emptyness or checking the VC-state) are performed stealthy. Now the current node in the methods-buffer can be expanded very precisely via new commands in the popup-menu. ECB has now the new upgrade policy \"Never touching the customization-files of a user without asking\". Some bug fixes. " + (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. " + "Click " (h-link "NEWS.html" "here") + " for information about changes in the new version. ") ,(h-sub-section "ECB 2.27 released! (2004-08-31)" "Much saver mechanism for resizing the permanent compile-window: Enlarging the compile-window does never destroy some ecb-windows, shrinking the compile-window shrinks always back to the correct size and all ecb-windows have their correct size after shrinking the compile-window. Some minor fixes. " (h-link "docs/Install-and-first-steps.html#Install%20and%20first%20steps" "Here") " is a short installation guide. "