Skip to content

Commit

Permalink
Changes for the next version with some big-fixes and some preparement…
Browse files Browse the repository at this point in the history
…s for

better code
  • Loading branch information
berndl committed Jan 27, 2006
1 parent d625a76 commit cb3afad
Show file tree
Hide file tree
Showing 14 changed files with 907 additions and 645 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -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

Expand Down Expand Up @@ -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 \
Expand Down
36 changes: 33 additions & 3 deletions 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
Expand All @@ -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 <hauke.jans@tietoenator.com> 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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:
--------
Expand Down
2 changes: 2 additions & 0 deletions ecb-analyse.el
Expand Up @@ -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."
Expand Down
108 changes: 106 additions & 2 deletions ecb-common-browser.el
Expand Up @@ -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 <klaus.berndl@sdm.de>: Only called from within
;; `defecb-interactor-synchronizer'.
(defun ecb-interactor-synchronizer-register (buffer-name-symbol
synchronizer-fcn)
""
)

;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: 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 <klaus.berndl@sdm.de>: 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 <klaus.berndl@sdm.de>: 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'."
Expand Down Expand Up @@ -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 -
Expand Down
129 changes: 129 additions & 0 deletions ecb-file-browser.el
Expand Up @@ -50,6 +50,7 @@

(silentcomp-defun ecb-speedbar-update-contents)
(silentcomp-defvar vc-cvs-stay-local)
(silentcomp-defvar dired-directory)

;;====================================================
;; Customization
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <klaus.berndl@sdm.de>: 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
Expand Down

0 comments on commit cb3afad

Please sign in to comment.