unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs 24 semantic C++ completion problem
@ 2011-12-29 18:32 Vyacheslav Gonakhchyan
  2011-12-29 22:03 ` Eric M. Ludlam
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-29 18:32 UTC (permalink / raw)
  To: emacs-devel


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

Hi,

I have a problem with C++ completion via builtin semantic.
Environment: Linux 3.1.5, Emacs 24.0.92.1(latest bzr build), attached
config file.


I use command semantic-ia-complete-symbol and get confusing errors(I cut
the some line - they are too long):

*1)*
Debugger entered--Lisp error: (error "Cannot find types for `\"mCamera\"'")
signal(error ("Cannot find types for `\"mCamera\"'"))
error("Cannot find types for `%s'" "\"mCamera\"")
semantic-analyze-possible-completions-default([object
semantic-analyze-context...
semantic-analyze-possible-completions([object semantic-analyze-context
"context" (690 . 690) ("mCamera" "")...
semantic-ia-complete-symbol(690)
call-interactively(semantic-ia-complete-symbol nil nil)

*2)*
Debugger entered--Lisp error: (wrong-type-argument
semantic-find-tags-by-scope-protection parent semantic-tag-class type)
signal(wrong-type-argument (semantic-find-tags-by-scope-protection parent
semantic-tag-class type))
semantic-find-tags-by-scope-protection(protected ("WindowEventListener"
variable
semantic-analyze-scoped-type-parts(("WindowEventListener" variable (:type
("_OgreExport" type
...(table dump)
semantic-analyze-scoped-inherited-tag-map(("BaseApplication" type
(:superclasses...
Semantic-analyze-scoped-inherited-tag-map(("TutorialApplication" type
(:superclasses (("BaseApplication"
semantic-analyze-scoped-inherited-tags(("TutorialApplication" type
(:superclasses (("BaseApplication" type...
semantic-analyze-scoped-type-parts(("TutorialApplication" type
(:superclasses (("BaseApplication" type...
semantic-analyze-scoped-tags-default(nil [object semantic-scope-cache
"Cache" [object semanticdb-table "Tut.cpp"...
semantic-analyze-scoped-tags(nil [object semantic-scope-cache "Cache"
[object semanticdb-table "Tut.cpp"...
semantic-calculate-scope(685)
semantic-analyze-current-context-default(685)
semantic-analyze-current-context(685)
semantic-ia-complete-symbol(685)
call-interactively(semantic-ia-complete-symbol nil nil)

I'm trying to make completion work for C++ and I need your advice.
Debugging these errors for newbie such as myself is tedious:(
Also please answer if you know workaround. If you have a working .emacs
config - it might help too.

Thanks,
Slava

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

[-- Attachment #2: .emacs --]
[-- Type: application/octet-stream, Size: 2577 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/OIS"))))
(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
(require 'semantic)
(require 'semantic/sb)
(require 'srecode)
(global-ede-mode 1)
(semantic-mode 1)
(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(global-semantic-idle-completions-mode 1)
(global-semantic-decoration-mode 1)
(global-semantic-highlight-func-mode 1)
(global-semantic-stickyfunc-mode -1)
(global-semantic-idle-summary-mode 1)
(global-semantic-mru-bookmark-mode 1)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
(set-default 'semantic-case-fold t)


;; ecb
(setq stack-trace-on-error t) ;WA for void-variable error
(require 'ecb)

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

;;CPP project
(ede-cpp-root-project "OgreTerrain"
                :name "OgreTerrain Project"
                :file "~/work/cpp/OgreTerrain/CMakeLists.txt"
				:include-path '("/")
                :system-include-path '("/usr/include/OGRE" 
				       "/usr/include/OGRE/Plugins"
				       "/usr/include/OGRE/Terrain"
				       "/usr/include/OIS")
              	)

;;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-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)


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Eric M. Ludlam @ 2011-12-29 22:03 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: emacs-devel

Hi,

When mysterious problems occur with the smart completion engine, it is 
often a challenge to figure out what is going on. - ie - is there a bug 
in Semantic, a setup issue, etc.

I always recommend using `semantic-analyze-debug-assist', used while 
point is in a location that caused the completion problem. 
Unfortunately, this command doesn't have an autoload cookie in Emacs, so 
you need to first:

M-x load-library RET semantic/analyze/debug RET

to make it available.  Hopefully its advice can help fix any 
configuration issues.  I'll guess you need to create a small EDE project 
to point Semantic to your headers.  Most likely using an example of 
ede-cpp-root project type.

For the 2nd problem you list, that seems more like a bug that may have 
been fixed with the version of CEDET from the CEDET bzr repository. 
There have been a few bug fixes there since CEDET was last merged into 
Emacs.  If setting up EDE fixes the first but not the second, you should 
check w/ the CEDET bzr repository.

Eric

On 12/29/2011 01:32 PM, Vyacheslav Gonakhchyan wrote:
> Hi,
>
> I have a problem with C++ completion via builtin semantic.
> Environment: Linux 3.1.5, Emacs 24.0.92.1(latest bzr build), attached
> config file.
>
>
> I use command semantic-ia-complete-symbol and get confusing errors(I cut
> the some line - they are too long):
>
> *1)*
> Debugger entered--Lisp error: (error "Cannot find types for `\"mCamera\"'")
> signal(error ("Cannot find types for `\"mCamera\"'"))
> error("Cannot find types for `%s'" "\"mCamera\"")
> semantic-analyze-possible-completions-default([object
> semantic-analyze-context...
> semantic-analyze-possible-completions([object semantic-analyze-context
> "context" (690 . 690) ("mCamera" "")...
> semantic-ia-complete-symbol(690)
> call-interactively(semantic-ia-complete-symbol nil nil)
>
> *2)*
> Debugger entered--Lisp error: (wrong-type-argument
> semantic-find-tags-by-scope-protection parent semantic-tag-class type)
> signal(wrong-type-argument (semantic-find-tags-by-scope-protection
> parent semantic-tag-class type))
> semantic-find-tags-by-scope-protection(protected ("WindowEventListener"
> variable
> semantic-analyze-scoped-type-parts(("WindowEventListener" variable
> (:type ("_OgreExport" type
> ...(table dump)
> semantic-analyze-scoped-inherited-tag-map(("BaseApplication" type
> (:superclasses...
> Semantic-analyze-scoped-inherited-tag-map(("TutorialApplication" type
> (:superclasses (("BaseApplication"
> semantic-analyze-scoped-inherited-tags(("TutorialApplication" type
> (:superclasses (("BaseApplication" type...
> semantic-analyze-scoped-type-parts(("TutorialApplication" type
> (:superclasses (("BaseApplication" type...
> semantic-analyze-scoped-tags-default(nil [object semantic-scope-cache
> "Cache" [object semanticdb-table "Tut.cpp"...
> semantic-analyze-scoped-tags(nil [object semantic-scope-cache "Cache"
> [object semanticdb-table "Tut.cpp"...
> semantic-calculate-scope(685)
> semantic-analyze-current-context-default(685)
> semantic-analyze-current-context(685)
> semantic-ia-complete-symbol(685)
> call-interactively(semantic-ia-complete-symbol nil nil)
>
>
> I'm trying to make completion work for C++ and I need your advice.
> Debugging these errors for newbie such as myself is tedious:(
> Also please answer if you know workaround. If you have a working .emacs
> config - it might help too.
>
> Thanks,
> Slava
>
>
>
> KGN1c3RvbS1zZXQtdmFyaWFibGVzCiA7OyBjdXN0b20tc2V0LXZhcmlhYmxlcyB3YXMgYWRkZWQg
> YnkgQ3VzdG9tLgogOzsgSWYgeW91IGVkaXQgaXQgYnkgaGFuZCwgeW91IGNvdWxkIG1lc3MgaXQg
> dXAsIHNvIGJlIGNhcmVmdWwuCiA7OyBZb3VyIGluaXQgZmlsZSBzaG91bGQgY29udGFpbiBvbmx5
> IG9uZSBzdWNoIGluc3RhbmNlLgogOzsgSWYgdGhlcmUgaXMgbW9yZSB0aGFuIG9uZSwgdGhleSB3
> b24ndCB3b3JrIHJpZ2h0LgogJyhlY2Itb3B0aW9ucy12ZXJzaW9uICIyLjQwIikKICcoZWNiLXBy
> aW1hcnktc2Vjb25kYXJ5LW1vdXNlLWJ1dHRvbnMgKHF1b3RlIG1vdXNlLTEtLUMtbW91c2UtMSkp
> CiAnKGluaGliaXQtc3RhcnR1cC1zY3JlZW4gdCkKICcoc2VtYW50aWMtYy1kZXBlbmRlbmN5LXN5
> c3RlbS1pbmNsdWRlLXBhdGggKHF1b3RlICgiL3Vzci9pbmNsdWRlIiAiL3Vzci9pbmNsdWRlL09H
> UkUiICIvdXNyL2luY2x1ZGUvT0lTIikpKSkKKGN1c3RvbS1zZXQtZmFjZXMKIDs7IGN1c3RvbS1z
> ZXQtZmFjZXMgd2FzIGFkZGVkIGJ5IEN1c3RvbS4KIDs7IElmIHlvdSBlZGl0IGl0IGJ5IGhhbmQs
> IHlvdSBjb3VsZCBtZXNzIGl0IHVwLCBzbyBiZSBjYXJlZnVsLgogOzsgWW91ciBpbml0IGZpbGUg
> c2hvdWxkIGNvbnRhaW4gb25seSBvbmUgc3VjaCBpbnN0YW5jZS4KIDs7IElmIHRoZXJlIGlzIG1v
> cmUgdGhhbiBvbmUsIHRoZXkgd29uJ3Qgd29yayByaWd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1jcCIgJ3NlbWFudGljLWFuYWx5emUtcHJvdG8taW1wbC10b2dnbGUpKQoo
> YWRkLWhvb2sgJ2MtbW9kZS1jb21tb24taG9vayAnbXktY2VkZXQtaG9vaykKCjsoZGVmdW4gbXkt
> Yy1tb2RlLWNlZGV0LWhvb2sgKCkKOyAobG9jYWwtc2V0LWtleSAiLiIgJ3NlbWFudGljLWNvbXBs
> ZXRlLXNlbGYtaW5zZXJ0KQo7IChsb2NhbC1zZXQta2V5ICI+IiAnc2VtYW50aWMtY29tcGxldGUt
> c2VsZi1pbnNlcnQpKQo7KGFkZC1ob29rICdjLW1vZGUtY29tbW9uLWhvb2sgJ215LWMtbW9kZS1j
> ZWRldC1ob29rKQoK



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-29 22:03 ` Eric M. Ludlam
@ 2011-12-30  9:22   ` David Engster
  2011-12-30 11:31     ` Vyacheslav Gonakhchyan
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2011-12-30  9:22 UTC (permalink / raw)
  To: Eric M. Ludlam; +Cc: Vyacheslav Gonakhchyan, emacs-devel

Eric M. Ludlam writes:
> For the 2nd problem you list, that seems more like a bug that may have
> been fixed with the version of CEDET from the CEDET bzr
> repository. There have been a few bug fixes there since CEDET was last
> merged into Emacs.  If setting up EDE fixes the first but not the
> second, you should check w/ the CEDET bzr repository.

FWIW, I tested Ogre3d with Semantic from bzr a while ago (after a
similar bug report on Semantic-devel), and it seemed to worked fine.

Note however that our current 'trunk' from bzr is setup a bit
differently than the one in Emacs. If you'd like to keep your current
.emacs setup, you better use our 'newtrunk' by doing

bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/newtrunk cedet

Simply compile using 'make' and then load CEDET through

(load-file "<PATH>/cedet-devel-load.el")

(preferrably at the beginning of your .emacs).

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30  9:22   ` David Engster
@ 2011-12-30 11:31     ` Vyacheslav Gonakhchyan
  2011-12-30 11:57       ` David Engster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-30 11:31 UTC (permalink / raw)
  To: Eric M. Ludlam, Vyacheslav Gonakhchyan, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

Thanks, Eric, David.
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.

Regards,
Slava

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

> Eric M. Ludlam writes:
> > For the 2nd problem you list, that seems more like a bug that may have
> > been fixed with the version of CEDET from the CEDET bzr
> > repository. There have been a few bug fixes there since CEDET was last
> > merged into Emacs.  If setting up EDE fixes the first but not the
> > second, you should check w/ the CEDET bzr repository.
>
> FWIW, I tested Ogre3d with Semantic from bzr a while ago (after a
> similar bug report on Semantic-devel), and it seemed to worked fine.
>
> Note however that our current 'trunk' from bzr is setup a bit
> differently than the one in Emacs. If you'd like to keep your current
> .emacs setup, you better use our 'newtrunk' by doing
>
> bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/newtrunkcedet
>
> Simply compile using 'make' and then load CEDET through
>
> (load-file "<PATH>/cedet-devel-load.el")
>
> (preferrably at the beginning of your .emacs).
>
> -David
>

[-- Attachment #2: Type: text/html, Size: 1886 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 11:31     ` Vyacheslav Gonakhchyan
@ 2011-12-30 11:57       ` David Engster
  2011-12-30 15:00         ` Vyacheslav Gonakhchyan
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2011-12-30 11:57 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

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



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 11:57       ` David Engster
@ 2011-12-30 15:00         ` Vyacheslav Gonakhchyan
  2011-12-30 16:51           ` David Engster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-30 15:00 UTC (permalink / raw)
  To: David Engster, Eric M. Ludlam, emacs-devel, Slava Gonakhchyan


[-- 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 --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 15:00         ` Vyacheslav Gonakhchyan
@ 2011-12-30 16:51           ` David Engster
  2011-12-30 19:52             ` Vyacheslav Gonakhchyan
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2011-12-30 16:51 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

Vyacheslav Gonakhchyan writes:
>>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):

[...]

Thanks; I could reproduce these issues. I think the main problem is with
preprocessor macros in class definitions, like

    class _OgreExport Light : public MovableObject

While you have defined _OgreExport in your project definition, this will
only apply to your own project files, not to system headers. I think the
easiest way to fix this is to use

(add-to-list 'semantic-lex-c-preprocessor-symbol-file
             '"/usr/include/OGRE/OgrePlatform.h")

You'll have to exit Emacs and delete all files in ~/.semanticdb to make
Semantic reparse the headers.

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 16:51           ` David Engster
@ 2011-12-30 19:52             ` Vyacheslav Gonakhchyan
  2011-12-30 20:06               ` David Engster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-30 19:52 UTC (permalink / raw)
  To: Eric M. Ludlam, emacs-devel, Vyacheslav Gonakhchyan

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

Yes. You're right. That solved all my problems with code completion.
To be precise I added these lines(with defvar with initial value):
(defvar semantic-lex-c-preprocessor-symbol-file '())
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
"/usr/include/OGRE/OgrePlatform.h")
Otherwise emacs threw void variable error.

Thanks!

Slava

On Fri, Dec 30, 2011 at 4:51 PM, David Engster <deng@randomsample.de> wrote:

> Vyacheslav Gonakhchyan writes:
> >>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):
>
> [...]
>
> Thanks; I could reproduce these issues. I think the main problem is with
> preprocessor macros in class definitions, like
>
>    class _OgreExport Light : public MovableObject
>
> While you have defined _OgreExport in your project definition, this will
> only apply to your own project files, not to system headers. I think the
> easiest way to fix this is to use
>
> (add-to-list 'semantic-lex-c-preprocessor-symbol-file
>             '"/usr/include/OGRE/OgrePlatform.h")
>
> You'll have to exit Emacs and delete all files in ~/.semanticdb to make
> Semantic reparse the headers.
>
> -David
>

[-- Attachment #2: Type: text/html, Size: 1749 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 19:52             ` Vyacheslav Gonakhchyan
@ 2011-12-30 20:06               ` David Engster
  2011-12-30 21:14                 ` Vyacheslav Gonakhchyan
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2011-12-30 20:06 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

Vyacheslav Gonakhchyan writes:
> Yes. You're right. That solved all my problems with code completion.
> To be precise I added these lines(with defvar with initial value):
> (defvar semantic-lex-c-preprocessor-symbol-file '())

Better do

(require 'semantic/bovine/c)

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 20:06               ` David Engster
@ 2011-12-30 21:14                 ` Vyacheslav Gonakhchyan
  2011-12-30 22:22                   ` David Engster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-30 21:14 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan, Eric M. Ludlam, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

It seems that requiring 'semantic/bovine/c too early fills
semantic-lex-c-preprocessor-
symbol-map with initial values. So it's not working that way.


On Fri, Dec 30, 2011 at 8:06 PM, David Engster <deng@randomsample.de> wrote:

> Vyacheslav Gonakhchyan writes:
> > Yes. You're right. That solved all my problems with code completion.
> > To be precise I added these lines(with defvar with initial value):
> > (defvar semantic-lex-c-preprocessor-symbol-file '())
>
> Better do
>
> (require 'semantic/bovine/c)
>
> -David
>

[-- Attachment #2: Type: text/html, Size: 920 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 21:14                 ` Vyacheslav Gonakhchyan
@ 2011-12-30 22:22                   ` David Engster
  2011-12-31  7:05                     ` Vyacheslav Gonakhchyan
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2011-12-30 22:22 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

Vyacheslav Gonakhchyan writes:
> It seems that requiring 'semantic/bovine/c too early fills
> semantic-lex-c-preprocessor-
> symbol-map with initial values. So it's not working that way.

Loading semantic/bovine/c is supposed to do that (it has some builtin
symbols and also adds those from c++config and sys/cdefs.h). However,
you should still be able to add further files without problems. If that
doesn't work, it's a bug.

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-30 22:22                   ` David Engster
@ 2011-12-31  7:05                     ` Vyacheslav Gonakhchyan
  2011-12-31 12:07                       ` David Engster
  0 siblings, 1 reply; 17+ messages in thread
From: Vyacheslav Gonakhchyan @ 2011-12-31  7:05 UTC (permalink / raw)
  To: Eric M. Ludlam, emacs-devel, Vyacheslav Gonakhchyan

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

I suppose semantic-c-reset-preprocessor-symbol-map hook(in bovine/c.el) is
removed before I change semantic-lex-c-preprocessor-symbol-file.

On Fri, Dec 30, 2011 at 10:22 PM, David Engster <deng@randomsample.de>wrote:

> Vyacheslav Gonakhchyan writes:
> > It seems that requiring 'semantic/bovine/c too early fills
> > semantic-lex-c-preprocessor-
> > symbol-map with initial values. So it's not working that way.
>
> Loading semantic/bovine/c is supposed to do that (it has some builtin
> symbols and also adds those from c++config and sys/cdefs.h). However,
> you should still be able to add further files without problems. If that
> doesn't work, it's a bug.
>
> -David
>

[-- Attachment #2: Type: text/html, Size: 1047 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  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
  0 siblings, 2 replies; 17+ messages in thread
From: David Engster @ 2011-12-31 12:07 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

Vyacheslav Gonakhchyan writes:
> I suppose semantic-c-reset-preprocessor-symbol-map hook(in bovine/c.el) is
> removed before I change semantic-lex-c-preprocessor-symbol-file.

I see. I activate Semantic later, which is why it still worked for me. I
think.

We used to have the `semantic-lex-c-preprocessor-symbol-file' defcustom
autoloaded, but that would never get past the Monnier-filter. I'm not
sure how to handle this now. You can set it via customize, which will
call `semantic-c-reset-preprocessor-symbol-map'; but we will have to
think of something for people who set it directly...

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2011-12-31 12:07                       ` David Engster
@ 2011-12-31 12:16                         ` David Engster
  2012-01-01 22:43                         ` Stefan Monnier
  1 sibling, 0 replies; 17+ messages in thread
From: David Engster @ 2011-12-31 12:16 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

David Engster writes:
> Vyacheslav Gonakhchyan writes:
>> I suppose semantic-c-reset-preprocessor-symbol-map hook(in bovine/c.el) is
>> removed before I change semantic-lex-c-preprocessor-symbol-file.
>
> I see. I activate Semantic later, which is why it still worked for me. I
> think.
>
> We used to have the `semantic-lex-c-preprocessor-symbol-file' defcustom
> autoloaded, but that would never get past the Monnier-filter. I'm not
> sure how to handle this now. You can set it via customize, which will
> call `semantic-c-reset-preprocessor-symbol-map'; but we will have to
> think of something for people who set it directly...

You can of course use

(setq-default semantic-lex-c-preprocessor-symbol-file
              '("/usr/include/OGRE/OgrePlatform.h"))

Still, this only works if you did *not* require semantic/bovine/c
before, so we still have to think of something better, since I know many
people require that file in their .emacs.

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  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
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2012-01-01 22:43 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

> We used to have the `semantic-lex-c-preprocessor-symbol-file' defcustom
> autoloaded, but that would never get past the Monnier-filter. I'm not

Could someone explain to me what is the problem?


        Stefan



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2012-01-01 22:43                         ` Stefan Monnier
@ 2012-01-02 19:33                           ` David Engster
  2012-01-05  4:43                             ` Stefan Monnier
  0 siblings, 1 reply; 17+ messages in thread
From: David Engster @ 2012-01-02 19:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eric M. Ludlam, Vyacheslav Gonakhchyan, emacs-devel

Stefan Monnier writes:
>> We used to have the `semantic-lex-c-preprocessor-symbol-file' defcustom
>> autoloaded, but that would never get past the Monnier-filter. I'm not
>
> Could someone explain to me what is the problem?

The general problem is this: Say you have a custom variable V, belonging
to package P, which is initialized with some list of filenames. When you
require P, it will use V's value to set up some things, but will only do
so once. How should the user add further filenames to V in his .emacs?
If he first requires P, then any changes to V will be moot. Hence he has
to look up the default value of V and then use setq-default, with the
additional files added. The simplest solution (or rather: cop-out) is to
autoload the defcustom, but I remember you saying that this is a no-no.

[To add a few details: `semantic-lex-c-preprocessor-symbol-file' is a
variable containing a list of C header files from which pre-processor
#defines will be included when parsing further C(++) files. Since
Semantic goes to great lengths to minimize startup time (a common
complaint back in the days), this will only be done when
semantic/bovine/c is actually loaded. It then parses those files and
populates `semantic-lex-c-preprocessor-symbol-map' with the macros it
finds, which is a c-mode local variable. Now, you may say that this is
bad design, and I tend to agree, but setting up the c-mode parser is
a pretty delicate issue.]

-David



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Emacs 24 semantic C++ completion problem
  2012-01-02 19:33                           ` David Engster
@ 2012-01-05  4:43                             ` Stefan Monnier
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Monnier @ 2012-01-05  4:43 UTC (permalink / raw)
  To: Vyacheslav Gonakhchyan; +Cc: Eric M. Ludlam, emacs-devel

>>> We used to have the `semantic-lex-c-preprocessor-symbol-file' defcustom
>>> autoloaded, but that would never get past the Monnier-filter. I'm not
>> Could someone explain to me what is the problem?
> The general problem is this: Say you have a custom variable V, belonging
> to package P, which is initialized with some list of filenames. When you
> require P, it will use V's value to set up some things, but will only do
> so once. How should the user add further filenames to V in his .emacs?
> If he first requires P, then any changes to V will be moot. Hence he has
> to look up the default value of V and then use setq-default, with the
> additional files added. The simplest solution (or rather: cop-out) is to
> autoload the defcustom, but I remember you saying that this is a no-no.

Real "no-no"s are hard to come by, and indeed autoloaded defcustoms are
easy to find in Emacs.
The best solution depends on how V is expected to change in time and on
what kind of changes the user is expected to apply to the value.

Note that if the var is modified via Custom, then Custom will store the
chosen value and further changes to V's default will be ignored, so if
that's considered bad, maybe it shouldn't be a defcustom at all.

If elements are almost never removed from that var, maybe splitting it
into two (a defcustom that defaults to nil and defvar which holds the
default set) will make things easier.


        Stefan



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2012-01-05  4:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).