unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Semantic & Autocomplete Usage
@ 2009-01-27  8:44 Les Harris
  2009-01-27 13:22 ` Shelagh Manton
  0 siblings, 1 reply; 4+ messages in thread
From: Les Harris @ 2009-01-27  8:44 UTC (permalink / raw)
  To: help-gnu-emacs


Does anyone have any experience using AutoComplete.el
(http://www.emacswiki.org/emacs/AutoComplete) with semantic
as a source?

I am also using Auto-Complete-Extension.el 
(http://www.emacswiki.org/cgi-bin/emacs/auto-complete-extension.el)
which provides among other things ac-source-semantic.

My configuration in .emacs:

(require 'auto-complete)
(require 'auto-complete-extension) ; Provides ac-source-semantic
(global-auto-complete-mode t)

(define-key ac-complete-mode-map "\C-\M-n" 'ac-next)
(define-key ac-complete-mode-map "\C-\M-p" 'ac-previous)
(define-key ac-complete-mode-map "\t" 'ac-expand)
(define-key ac-complete-mode-map "\r" 'ac-complete)

<snip>

(add-hook 'c-mode-common-hook '(lambda ()
	(c-toggle-auto-state 1)
	(linum-mode)
	(set (make-local-variable 'ac-sources) 
                                  (append '(ac-source-semantic)))
;	(set (make-local-variable 'ac-candidate-function) (append
	'ac-semantic-candidate))
))

It apparently does nothing :)  When I uncomment the
ac-candidate-function line I get a syntax error:

Error in post-command-hook: (wrong-number-of-arguments (lambda (prefix) 
(if (memq major-mode (quote (c-mode c++-mode jde-mode java-mode)))
(prog1 (mapcar (quote semantic-tag-name) (ignore-errors (or
 (semantic-ia-get-completions (semantic-analyze-current-context) 
(point)) (senator-find-tag-for-completion 
(regexp-quote prefix)))))))) 0)

Which is from auto-complete-extension.el. Doesn't inspire confidence.

If I try running something like semantic-analyze-possible-completions on
the following:
pMyObject->
It will correctly list the members of that struct so I am confidant
semantic itself is working correctly.

So I'm stuck.  Anyone help at all would be very appreciated.

Thanks!

-- 
Do they only stand
By ignorance, is that their happy state,
The proof of their obedience and their faith?


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

* Re: Semantic & Autocomplete Usage
  2009-01-27  8:44 Semantic & Autocomplete Usage Les Harris
@ 2009-01-27 13:22 ` Shelagh Manton
  2009-01-27 13:45   ` Shelagh Manton
       [not found]   ` <mailman.5954.1233063953.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Shelagh Manton @ 2009-01-27 13:22 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 27 Jan 2009 00:44:27 -0800, Les Harris wrote:

> (add-hook 'c-mode-common-hook '(lambda ()
> 	(c-toggle-auto-state 1)
> 	(linum-mode)
> 	(set (make-local-variable 'ac-sources)
>                                   (append '(ac-source-semantic)))
> ;	(set (make-local-variable 'ac-candidate-function) (append
> 	'ac-semantic-candidate))
> ))

I wonder if this might work better.

(add-hook 'c-mode-common-hook '(lambda ()
	(c-toggle-auto-state 1)
 	(linum-mode)
 	(make-local-variable 'ac-sources)
        (setq ac-sources '(ac-source-semantic ;and optionally 
;ac-source-abbrev ac-source-words-in-buffer
))
                           

This looks more like a successful auto-complete setup I have, though for 
a different mode and with my own homegrown set of keywords.

Shelagh





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

* Re: Semantic & Autocomplete Usage
  2009-01-27 13:22 ` Shelagh Manton
@ 2009-01-27 13:45   ` Shelagh Manton
       [not found]   ` <mailman.5954.1233063953.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Shelagh Manton @ 2009-01-27 13:45 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 27 Jan 2009 13:22:44 +0000, Shelagh Manton wrote:

> On Tue, 27 Jan 2009 00:44:27 -0800, Les Harris wrote:
> 
>> (add-hook 'c-mode-common-hook '(lambda ()
>> 	(c-toggle-auto-state 1)
>> 	(linum-mode)
>> 	(set (make-local-variable 'ac-sources)
>>                                   (append '(ac-source-semantic)))
>> ;	(set (make-local-variable 'ac-candidate-function) (append
>> 	'ac-semantic-candidate))
>> ))
> 
> I wonder if this might work better.
> 
> (add-hook 'c-mode-common-hook '(lambda ()
> 	(c-toggle-auto-state 1)
>  	(linum-mode)
>  	(make-local-variable 'ac-sources)
>         (setq ac-sources '(ac-source-semantic ;and optionally
> ;ac-source-abbrev ac-source-words-in-buffer ))
>                            
>                            
> This looks more like a successful auto-complete setup I have, though for
> a different mode and with my own homegrown set of keywords.
> 
> Shelagh

Ps I contacted the developer of the auto-complete-extension package and 
he thinks the semantic functions do not work well, so that might be your 
problem.

SOM





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

* Re: Semantic & Autocomplete Usage
       [not found]   ` <mailman.5954.1233063953.26697.help-gnu-emacs@gnu.org>
@ 2009-01-27 14:05     ` Les Harris
  0 siblings, 0 replies; 4+ messages in thread
From: Les Harris @ 2009-01-27 14:05 UTC (permalink / raw)
  To: help-gnu-emacs

Shelagh Manton <shelagh.manton@gmail.com> writes:

> On Tue, 27 Jan 2009 13:22:44 +0000, Shelagh Manton wrote:

> Ps I contacted the developer of the auto-complete-extension package and 
> he thinks the semantic functions do not work well, so that might be your 
> problem.
>
> SOM

You really went above and beyond the call of duty! I notice the semantic
functions in that package have since been removed.  The other listing
provided on the wiki also appears not to function.

So in the mean time I guess I will simply try to implement a functioning
ac-semantic-source.  I notice in the development version of AutoComplete
the author has semantic support in the todo section so if all else fails
I suspect time will fix this issue for me one way or the other.

Thank you for all your help!

-- 
Do they only stand
By ignorance, is that their happy state,
The proof of their obedience and their faith?


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

end of thread, other threads:[~2009-01-27 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-27  8:44 Semantic & Autocomplete Usage Les Harris
2009-01-27 13:22 ` Shelagh Manton
2009-01-27 13:45   ` Shelagh Manton
     [not found]   ` <mailman.5954.1233063953.26697.help-gnu-emacs@gnu.org>
2009-01-27 14:05     ` Les Harris

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