Re: Srecode should be independent of Semantic

"Eric M. Ludlam" <[email protected]>
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
On 06/04/2014 06:42 AM, Tu Do wrote:
> Currently, I only want to use Srecode inside Common Lisp. To use
> Srecode, I have to activate Semantic mode, and I'm using
> semantic-idle-summary-mode for C/C++ buffers, so
> semantic-idle-summary-mode is activate for Common Lisp buffers as well.
> The problem is, semantic-idle-summary-mode does not display correct
> signatures from Common Lisp; it displays signatures from Emacs Lisp.
>
> To turn it off, I have to activate Semantic only in C/C++/Emacs Lisp modes:
>
> (add-to-list 'semantic-inhibit-functions
>               (lambda () (not (member major-mode '(c-mode c++-mode
> emacs-lisp-mode)))))
>
> However, doing like this disables srecode-minor-mode because it requires
> Semantic bufers. Is there a way to fix it?
>
> This SO question and answer does not help:
> http://stackoverflow.com/questions/6782114/disable-cedet-semantic-code-completion-for-lisp-mode

Hi Tu,

The reason SRecode needs Semantic is because several of it's features 
depends on information from semantic.  For example, it asks semantic 
where in the buffer you are so it can provide better template choices. 
In addition, many templates depend on input variables calculated from 
the semantic information in the local environment.

I suspect what you really want is to enable/disable combinations of 
different semantic related minor modes only in major modes of your choice.

As in the stack-overflow article you point out, you can allow Semantic 
to init normally in all it's modes, but don't enable those modes via the 
semantic-init-hook, or via semantic-default-submodes, nor via the 
'global-*' version of the mode function.  Instead turn on the mode via 
the non-global function in the mode hook.

For example:

(add-hook 'c-mode-hook 'semantic-idle-summary-mode)

you could also turn all the different semantic modes on by default, but 
turn off some semantic modes in your major-mode hook:

(add-hook emacs-lisp-mode-hook (lambda () (semantic-idle-summary-mode -1))

As for idle-summary-mode, it should be off by default in Emacs Lisp mode 
as it defers to eldoc mode.  I hadn't tried it in common-lisp mode, 
perhaps semantic is forcing eldoc to run in common lisp in an Emacs Lisp 
style..

I hope this helps.
Eric

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.