unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vyacheslav Gonakhchyan <ytriffy@gmail.com>
To: David Engster <deng@randomsample.de>,
	"Eric M. Ludlam" <ericludlam@gmail.com>,
	emacs-devel@gnu.org,  Slava Gonakhchyan <ytriffy@gmail.com>
Subject: Re: Emacs 24 semantic C++ completion problem
Date: Fri, 30 Dec 2011 15:00:17 +0000	[thread overview]
Message-ID: <CAJ654bsgHGrEUvtv6FZAmy=ab-yoW3c5nMcP6-YbdBaOHkZNPg@mail.gmail.com> (raw)
In-Reply-To: <878vlu9ss2.fsf@engster.org>


[-- Attachment #1.1: Type: text/plain, Size: 2410 bytes --]

>Could you please provide an example, showing what you're trying to
>complete and what member functions you would expect to appear?
Attached zip file with project. There are two markers in code(Tut.cpp):
ERR1, ERR2.
ERR1: many incorrect completion variants(it dumps constants, headers etc
from many places - it results in 58KB file).
ERR2: error on completion(error 2 from my first message).
Unfortunately to reproduce ERR1 you should have Ogre installed.
ERR2 should be possible to reproduce on project code.

I also tried another simple project setup with vector class from stl.
Completion variants were correct there.
That leads me to beleive that some defines from Ogre(like OGRE_PLATFORM,
_OgreExport, _OgrePrivate) break semantic.

So to summarize:
*What works:*
Ogre::Real - completes fine
Ogre::SOME_CONST - completes fine
function name or variable name from local buffer - completes fine

*What does not work:*
*1)*
void TutorialApplication::configureTerrainDefaults(Ogre::Light* light)
{
  light-> //a lot of garbage variants
}

*2)*
mRoot is defined in BaseApp.h and its type is visible in echo area.
But when trying to complete mRoot's member function in Tut.cpp I get error
(error "Cannot find types for `\"mRoot\"'").
I think semantic cannot derive its type. It can understand types of local
variables only(and mRoot is defined in another file).

*3)*
In function main local variable is defined TutorialApplication app.
When trying to complete
app.
I always get
(wrong-type-argument semantic-find-tags-by-scope-protection parent
semantic-tag-class type)

*4)
*When trying to complete*
*this->
I always get
(wrong-type-argument semantic-find-tags-by-scope-protection parent
semantic-tag-class type)

Regards,
Slava

On Fri, Dec 30, 2011 at 11:57 AM, David Engster <deng@randomsample.de>wrote:

> Vyacheslav Gonakhchyan writes:
> > Using cedet newtrunk helped. I can complete types without a problem.
> > Although when trying to complete member functions a lot of variants
> appear
> > and non of
> > them seem to be right.
> > Also sometimes I get errors(like in my first message) and on second try
> it
> > works.
>
> Could you please provide an example, showing what you're trying to
> complete and what member functions you would expect to appear? Please
> provide a complete buffer, that means with all #include directives
> you're using, since this is where Semantic is looking.
>
> -David
>

[-- Attachment #1.2: Type: text/html, Size: 3019 bytes --]

[-- Attachment #2: proj.zip --]
[-- Type: application/zip, Size: 5850 bytes --]

[-- Attachment #3: .emacs --]
[-- Type: application/octet-stream, Size: 3241 bytes --]

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ecb-options-version "2.40")
 '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1))
 '(inhibit-startup-screen t)
; '(semantic-c-dependency-system-include-path (quote ("/usr/include" "/usr/include/OGRE" "/usr/include/OGRE/Plugins" "/usr/include/OGRE/Terrain" "/usr/include/OIS")))
; '(semanticdb-project-roots (quote ("/home/archpoet/work/cpp/OgreTerrain")))
)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(autoload 'php-mode "php-mode.el" "Php mode." t)
(setq auto-mode-alist (append '(("/*.\.php[345]?$" . php-mode)) auto-mode-alist))

;;Custom code
(add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp/"))
(add-to-list 'load-path (expand-file-name "~/work/emacs/ecb/"))

;;CEDET
(load-file (expand-file-name "~/work/emacs/cedet_devel-bzr/cedet-devel-load.el"))
(semantic-load-enable-code-helpers)
(global-ede-mode 1)                      ; Enable the Project management system

;;CPP project
(ede-cpp-root-project "OgreTerrain"
                :file "/home/archpoet/work/cpp/OgreTerrain/CMakeLists.txt"
				:include-path '("/")
              	:system-include-path '("/usr/include/OGRE" "/usr/include/OGRE/Plugins" "/usr/include/OGRE/Terrain" "/usr/include/OIS")
             	:spp-table '( 	("OGRE_PLATFORM" . "OGRE_PLATFORM_LINUX")
								("_OgreExport" . "")
								("_OgrePrivate" . "")
                       			("CONST" . "const")))

(ede-cpp-root-project "CppTest"
                :file "/home/archpoet/work/cpp/CppTest/readme"
				:include-path '("/")
              	:system-include-path '("/usr/include" "/usr/include/c++/4.6.2")
             	:spp-table '( ("CONST" . "const")))

(global-srecode-minor-mode 1)            ; Enable template insertion menu

;(setq ede-locate-setup-options '(ede-locate-global ede-locate-base))

;(semanticdb-enable-gnu-global-databases 'c++-mode)

(setq-mode-local c-mode
                      semanticdb-find-default-throttle
                      '(project unloaded system recursive))

;; ecb - does not work with latest cedet
;;(setq stack-trace-on-error t) ;WA for void-variable error
;;(require 'ecb)

;;Turn Debug ON
(setq debug-on-error t)

;;semantic key bindings
(defun my-cedet-hook ()
  (local-set-key [(control return)] 'semantic-ia-complete-symbol)
  (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
  (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
  (local-set-key "\C-cj" 'semantic-ia-fast-jump)
  (local-set-key "\C-ch" 'semantic-ia-show-doc)
  (local-set-key "\C-cv" 'semantic-ia-show-variants)
  (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
(add-hook 'c-mode-common-hook 'my-cedet-hook)

;(defun my-c-mode-cedet-hook ()
; (local-set-key "." 'semantic-complete-self-insert)
; (local-set-key ">" 'semantic-complete-self-insert))
;(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)


[-- Attachment #4: proj.zip --]
[-- Type: application/zip, Size: 8048 bytes --]

  reply	other threads:[~2011-12-30 15:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 18:32 Emacs 24 semantic C++ completion problem Vyacheslav Gonakhchyan
2011-12-29 22:03 ` Eric M. Ludlam
2011-12-30  9:22   ` David Engster
2011-12-30 11:31     ` Vyacheslav Gonakhchyan
2011-12-30 11:57       ` David Engster
2011-12-30 15:00         ` Vyacheslav Gonakhchyan [this message]
2011-12-30 16:51           ` David Engster
2011-12-30 19:52             ` Vyacheslav Gonakhchyan
2011-12-30 20:06               ` David Engster
2011-12-30 21:14                 ` Vyacheslav Gonakhchyan
2011-12-30 22:22                   ` David Engster
2011-12-31  7:05                     ` Vyacheslav Gonakhchyan
2011-12-31 12:07                       ` David Engster
2011-12-31 12:16                         ` David Engster
2012-01-01 22:43                         ` Stefan Monnier
2012-01-02 19:33                           ` David Engster
2012-01-05  4:43                             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ654bsgHGrEUvtv6FZAmy=ab-yoW3c5nMcP6-YbdBaOHkZNPg@mail.gmail.com' \
    --to=ytriffy@gmail.com \
    --cc=deng@randomsample.de \
    --cc=emacs-devel@gnu.org \
    --cc=ericludlam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).