Subject: bug#8092: 24.0.50; ede-emacs error with un-configured emacs source

From: Darren Hoo <[email-masked]>
Date: Tue, 22 Feb 2011 03:14:35 +0800

turn on ede

(global-ede-mode t)

then trying dire-find-file on emacs src directory shows

semanticdb-file-table-object: Wrong type argument: stringp, nil 

full trace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-exists-p(nil)
  semanticdb-file-table-object(nil)
  ede-emacs-target-c([object ede-emacs-target-c "ede-emacs-target-c" nil "src" "/home/darren/mnt/emacs/src/" nil nil])
  apply(ede-emacs-target-c [object ede-emacs-target-c "ede-emacs-target-c" nil "src" "/home/darren/mnt/emacs/src/" nil nil])
  eieio-generic-call-primary-only(ede-preprocessor-map ([object ede-emacs-target-c "ede-emacs-target-c" nil "src" "/home/darren/mnt/emacs/src/" nil nil]))
  ede-preprocessor-map([object ede-emacs-target-c "ede-emacs-target-c" nil "src" "/home/darren/mnt/emacs/src/" nil nil])
  ede-apply-preprocessor-map()
  ede-apply-target-options()
  ede-initialize-state-current-buffer()
  ede-minor-mode(1)
  ede-turn-on-hook()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer buffer.c> "~/mnt/emacs/src/buffer.c" nil nil "~/mnt/emacs/src/buffer.c" (3464 25))
  find-file-noselect("/home/darren/mnt/emacs/src/buffer.c" nil nil nil)
  find-file("/home/darren/mnt/emacs/src/buffer.c")
  dired-find-file()
  call-interactively(dired-find-file nil nil)

I think this should be handled gracefully, if reminding user to configure
emacs first is even better.

diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index b8759dd..cee7c70 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -245,6 +245,8 @@ All files need the macros from lisp.h!"
        (semanticdb-refresh-table config))
       (setq filemap (append filemap (oref config lexical-table)))
       )
+    (or config
+       (message "%s" "Missing config.h, configure your Emacs src first"))
     filemap
     ))
 
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index fa8de39..dca1b3b 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -880,7 +880,7 @@ If file does not have tags available, and DONTLOAD is nil,
 then load the tags for FILE, and create a new table object for it.
 DONTLOAD does not affect the creation of new database objects."
   ;; (message "Object Translate: %s" file)
-  (when (file-exists-p file)
+  (when (and file (file-exists-p file))
     (let* ((default-directory (file-name-directory file))
           (tab (semanticdb-file-table-object-from-hash file))
           (fullfile nil))