diff options
author | Eric M. Ludlam <zappo@gnu.org> | 2010-09-20 22:42:53 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-09-20 22:42:53 -0400 |
commit | cb85c0d8be968992eef85e633133f65a3996830d (patch) | |
tree | 48fcc9800f8ba92bd03ca769466fbb202a09a5f5 /lisp/cedet/ede/files.el | |
parent | 9e0d4f9ef1cd4d7149c84475df5cef4d408743b6 (diff) | |
download | emacs-cb85c0d8be968992eef85e633133f65a3996830d.tar.gz |
Synch EDE to CEDET 1.0.
* cedet-idutils.el (cedet-idutils-make-command): New option.
(cedet-idutils-mkid-call):
(cedet-idutils-create/update-database): New functions.
* cedet-cscope.el (cedet-cscope-create):
(cedet-cscope-create/update-database): New functions.
(cedet-cscope-support-for-directory): Make interactive.
* cedet-global.el (cedet-global-gtags-command): New option.
(cedet-gnu-global-gtags-call)
(cedet-gnu-global-create/update-database): New functions.
* ede.el (ede-save-cache): Fix recentf-exclude expression.
(ede-make-dist): Always use toplevel project.
(ede-buffer-object): If we fail to find an object in the current
project, loop upward looking for a match. If no target is found,
use most local project.
(ede-buffer-belongs-to-target-p)
(ede-buffer-belongs-to-project-p): New functions.
(ede-initialize-state-current-buffer): New function.
(ede-target-forms-menu, ede-project-buffers): Use them.
(ede-minor-mode, ede-reset-all-buffers): Use it.
(project-interactive-select-target, project-add-file): Don't use
ede-project-force-load.
(ede-buffer-object): New arg PROJSYM.
(ede-minor-mode): Remove ede-directory-project-p test.
(ede-initialize-state-current-buffer): Don't test for
ede-directory-project-p if there is a matching open project.
(ede-customize-forms-menu): Prevent error if there is no project.
(ede-load-project-file): Set ede-constructing to the thing being
constructed, instead of t.
(ede-project-force-load): Deleted.
* ede/base.el:
* ede/auto.el:
* ede/custom.el: New files.
* ede/autoconf-edit.el (autoconf-find-last-macro)
(autoconf-parameters-for-macro): Parse multiline parameters of
macros. Optionally ignore case and at bol for macro.
(autoconf-parameter-strip): Use greedy match for newlines.
(autoconf-new-automake-string): Deleted.
(autoconf-new-program): Use SRecode to fill an empty file.
* ede/cpp-root.el (ede-create-lots-of-projects-under-dir): New
function.
* ede/files.el (ede-flush-project-hash): New command.
(ede-convert-path): Add optional PROJECT arg.
(ede-directory-project-p): Obey ".ede-ignore".
(ede-expand-filename-local)
(ede-expand-filename-impl-via-subproj): New methods.
(ede-expand-filename-impl): Use them.
(ede-project-root, ede-project-root-directory): Move to
ede/auto.el.
* ede/locate.el (ede-locate-flush-hash):
(ede-locate-create/update-root-database): New methods.
(initialize-instance): Use ede-locate-flush-hash.
* ede/pmake.el (ede-proj-makefile-insert-variables): If this is
the top project and not a metasubproject, set TOP to CURDIR.
(ede-proj-makefile-insert-variables): Output a target's object
list whether or not the vars are already in the Makefile.
(ede-pmake-insert-variable-once): New macro.
* ede/project-am.el (project-am-with-makefile-current): Add
recentf-exclude.
(project-am-load-makefile): Obey an optional suggested name.
(project-am-expand-subdirlist): New function.
(project-am-makefile::project-rescan): Use it. Combine SUBDIRS
and DIST_SUBDIRS.
(project-am-meta-type-alist): A list to scan better Makefile.am
(project-am-scan-for-targets): Scan also over
project-am-meta-type-alist.
(ede-system-include-path): Simple implementation.
(ede-find-target): Deleted. EDE core takes care of this.
(ede-buffer-mine): Create the searched filename as relative.
(project-am-load): Simplify, using autoconf-edit.
(project-am-extract-package-info): Fix separators.
* ede/proj.el (project-run-target): New method.
(project-make-dist, project-compile-project): Use
ede-proj-automake-p to determine which kind of compile to use.
(project-rescan): Call ede-load-project-file.
(ede-buffer-mine): Add more file names that belong to the project.
(ede-proj-compilers): Improve error message.
* ede/proj-obj.el (ede-ld-linker): Use the LDDEPS variable.
(ede-source-c++): Add more C++ extensions.
(ede-proj-target-makefile-objectcode): Quote initforms. Support
lex and yacc.
* ede/proj-prog.el (ede-proj-makefile-insert-rules): Removed.
(ede-proj-makefile-insert-variables): New, add LDDEPS.
(ede-proj-makefile-insert-automake-post-variables): Add LDADD
variable. Use ldlibs-local slot. Add a -l to ldlibs strings.
(ede-proj-target-makefile-program): Swap order of two slots so
they show up in the same order as in the command line.
(ede-proj-target-makefile-program): Add ldlibs-local slot.
* ede/proj-shared.el (ede-g++-libtool-shared-compiler): Fix
inference rule to use cpp files.
(ede-proj-target-makefile-shared-object): Quote initforms.
* ede/proj-misc.el (ede-proj-target-makefile-miscelaneous):
* ede/proj-info.el (ede-proj-target-makefile-info):
* ede/proj-aux.el (ede-proj-target-aux):
* ede/proj-archive.el (ede-proj-target-makefile-archive):
* ede/proj-elisp.el (ede-proj-target-elisp)
(ede-proj-target-elisp-autoloads): Quote initforms.
* ede/srecode.el (ede-srecode-setup): Load autoconf templates.
* ede/shell.el (ede-shell-buffer): Fix buffer name.
* ede/pconf.el (ede-proj-configure-synchronize): If user events
occur while waiting for the compile process to finish, pull them
in and discard those events.
Diffstat (limited to 'lisp/cedet/ede/files.el')
-rw-r--r-- | lisp/cedet/ede/files.el | 147 |
1 files changed, 68 insertions, 79 deletions
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el index 2f86b766158..87145d8c8a1 100644 --- a/lisp/cedet/ede/files.el +++ b/lisp/cedet/ede/files.el @@ -38,6 +38,7 @@ (declare-function ede-locate-file-in-hash "ede/locate") (declare-function ede-locate-add-file-to-hash "ede/locate") (declare-function ede-locate-file-in-project "ede/locate") +(declare-function ede-locate-flush-hash "ede/locate") (defvar ede--disable-inode nil "Set to 't' to simulate systems w/out inode support.") @@ -57,44 +58,29 @@ the current EDE project." (ede-project-root-directory (ede-current-project)))) (find-file fname))) +(defun ede-flush-project-hash () + "Flush the file locate hash for the current project." + (interactive) + (require 'ede/locate) + (let* ((loc (ede-get-locator-object (ede-current-project)))) + (ede-locate-flush-hash loc))) + ;;; Placeholders for ROOT directory scanning on base objects ;; (defmethod ede-project-root ((this ede-project-placeholder)) - "If a project knows it's root, return it here. + "If a project knows its root, return it here. Allows for one-project-object-for-a-tree type systems." (oref this rootproject)) (defmethod ede-project-root-directory ((this ede-project-placeholder) &optional file) - "If a project knows it's root, return it here. + "If a project knows its root, return it here. Allows for one-project-object-for-a-tree type systems. Optional FILE is the file to test. It is ignored in preference of the anchor file for the project." (file-name-directory (expand-file-name (oref this file)))) -(defmethod ede-project-root ((this ede-project-autoload)) - "If a project knows it's root, return it here. -Allows for one-project-object-for-a-tree type systems." - nil) - -(defmethod ede-project-root-directory ((this ede-project-autoload) - &optional file) - "If a project knows it's root, return it here. -Allows for one-project-object-for-a-tree type systems. -Optional FILE is the file to test. If there is no FILE, use -the current buffer." - (when (not file) - (setq file default-directory)) - (when (slot-boundp this :proj-root) - (let ((rootfcn (oref this proj-root))) - (when rootfcn - (condition-case nil - (funcall rootfcn file) - (error - (funcall rootfcn))) - )))) - (defmethod ede--project-inode ((proj ede-project-placeholder)) "Get the inode of the directory project PROJ is in." (if (slot-boundp proj 'dirinode) @@ -262,27 +248,30 @@ Do this whenever a new project is created, as opposed to loaded." (defun ede-directory-project-p (dir &optional force) "Return a project description object if DIR has a project. Optional argument FORCE means to ignore a hash-hit of 'nomatch. -This depends on an up to date `ede-project-class-files' variable." - (let* ((dirtest (expand-file-name dir)) - (match (ede-directory-project-from-hash dirtest))) - (cond - ((and (eq match 'nomatch) (not force)) - nil) - ((and match (not (eq match 'nomatch))) - match) - (t - (let ((types ede-project-class-files) - (ret nil)) - ;; Loop over all types, loading in the first type that we find. - (while (and types (not ret)) - (if (ede-dir-to-projectfile (car types) dirtest) - (progn - ;; We found one! Require it now since we will need it. - (require (oref (car types) file)) - (setq ret (car types)))) - (setq types (cdr types))) - (ede-directory-project-add-description-to-hash dirtest (or ret 'nomatch)) - ret))))) +This depends on an up to date `ede-project-class-files' variable. +Any directory that contains the file .ede-ignore will allways +return nil." + (when (not (file-exists-p (expand-file-name ".ede-ignore" dir))) + (let* ((dirtest (expand-file-name dir)) + (match (ede-directory-project-from-hash dirtest))) + (cond + ((and (eq match 'nomatch) (not force)) + nil) + ((and match (not (eq match 'nomatch))) + match) + (t + (let ((types ede-project-class-files) + (ret nil)) + ;; Loop over all types, loading in the first type that we find. + (while (and types (not ret)) + (if (ede-dir-to-projectfile (car types) dirtest) + (progn + ;; We found one! Require it now since we will need it. + (require (oref (car types) file)) + (setq ret (car types)))) + (setq types (cdr types))) + (ede-directory-project-add-description-to-hash dirtest (or ret 'nomatch)) + ret)))))) ;;; TOPLEVEL ;; @@ -324,7 +313,7 @@ nil is returned if the current directory is not a part of a project." ;; If PROJ didn't know, or there is no PROJ, then ;; Loop up to the topmost project, and then load that single - ;; project, and it's sub projects. When we are done, identify the + ;; project, and its sub projects. When we are done, identify the ;; sub-project object belonging to file. (while (and (not ans) newpath proj) (setq toppath newpath @@ -338,24 +327,6 @@ nil is returned if the current directory is not a part of a project." ) (or ans toppath)))))) -;;; TOPLEVEL PROJECT -;; -;; The toplevel project is a way to identify the EDE structure that belongs -;; to the top of a project. - -(defun ede-toplevel (&optional subproj) - "Return the ede project which is the root of the current project. -Optional argument SUBPROJ indicates a subproject to start from -instead of the current project." - (or ede-object-root-project - (let* ((cp (or subproj (ede-current-project))) - ) - (or (and cp (ede-project-root cp)) - (progn - (while (ede-parent-project cp) - (setq cp (ede-parent-project cp))) - cp))))) - ;;; DIRECTORY CONVERSION STUFF ;; (defmethod ede-convert-path ((this ede-project) path) @@ -372,11 +343,13 @@ Argument THIS is the project to convert PATH to." (substring fptf (match-end 0)) (error "Cannot convert relativize path %s" fp)))))) -(defmethod ede-convert-path ((this ede-target) path) +(defmethod ede-convert-path ((this ede-target) path &optional project) "Convert path in a standard way for a given project. Default to making it project relative. -Argument THIS is the project to convert PATH to." - (let ((proj (ede-target-parent this))) +Argument THIS is the project to convert PATH to. +Optional PROJECT is the project that THIS belongs to. Associating +a target to a project is expensive, so using this can speed things up." + (let ((proj (or project (ede-target-parent this)))) (if proj (let ((p (ede-convert-path proj path)) (lp (or (oref this path) ""))) @@ -406,7 +379,8 @@ FILENAME should be just a filename which occurs in a directory controlled by this project. Optional argument FORCE forces the default filename to be provided even if it doesn't exist. -If FORCE equals 'newfile, then the cache is ignored." +If FORCE equals 'newfile, then the cache is ignored and a new file in THIS +is returned." (require 'ede/locate) (let* ((loc (ede-get-locator-object this)) (ha (ede-locate-file-in-hash loc filename)) @@ -467,17 +441,8 @@ doesn't exist." (proj (oref this subproj)) (found nil)) ;; find it Locally. - (setq found - (cond ((file-exists-p (expand-file-name filename path)) - (expand-file-name filename path)) - ((file-exists-p (expand-file-name (concat "include/" filename) path)) - (expand-file-name (concat "include/" filename) path)) - (t - (while (and (not found) proj) - (setq found (when (car proj) - (ede-expand-filename (car proj) filename)) - proj (cdr proj))) - found))) + (setq found (or (ede-expand-filename-local this filename) + (ede-expand-filename-impl-via-subproj this filename))) ;; Use an external locate tool. (when (not found) (require 'ede/locate) @@ -485,6 +450,30 @@ doesn't exist." ;; Return it found)) +(defmethod ede-expand-filename-local ((this ede-project) filename) + "Expand filename locally to project THIS with filesystem tests." + (let ((path (ede-project-root-directory this))) + (cond ((file-exists-p (expand-file-name filename path)) + (expand-file-name filename path)) + ((file-exists-p (expand-file-name (concat "include/" filename) path)) + (expand-file-name (concat "include/" filename) path))))) + +(defmethod ede-expand-filename-impl-via-subproj ((this ede-project) filename) + "Return a fully qualified file name based on project THIS. +FILENAME should be just a filename which occurs in a directory controlled +by this project." + (let ((proj (list (ede-toplevel this))) + (found nil)) + ;; find it Locally. + (while (and (not found) proj) + (let ((thisproj (car proj))) + (setq proj (append (cdr proj) (oref thisproj subproj))) + (setq found (when thisproj + (ede-expand-filename-local thisproj filename))) + )) + ;; Return it + found)) + (defmethod ede-expand-filename ((this ede-target) filename &optional force) "Return a fully qualified file name based on target THIS. FILENAME should be a filename which occurs in a directory in which THIS works. |