emacs24 semantic completion - emacs

I'm trying to get semantic completions working with emacs 24 and the version of cedet that comes with it. Completions work for classes I defined in my own source file, but completion isn't working for the standard library or STL stuff Here is my emacs config:
(require 'cedet)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(semantic-add-system-include "/usr/include/c++/4.6.3" 'c++-mode)
(setq semantic-default-submodes
'(global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode
global-semantic-idle-summary-mode
global-semantic-idle-completions-mode
global-semantic-highlight-func-mode
global-semantic-decoration-mode
global-semantic-mru-bookmark-mode))
(setq semanticdb-default-save-directory "~/.semanticdb/"
semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-ghost)
(semantic-mode t)
In my ~/.semanticdb directory I only see "!usr!include!c++!4.6!x86_64-linux-gnu!bits!semantic.cache", which isn't even using the version I specified in the config.
When I try M-x semantic-analyze-possible-completions on a std::list, for example, I get an error saying: "Cannot find types for std::list"
Any suggestions for how to debug this or how to fix it?

I was installing today a fresh Ubuntu 13.04 on my new SSD,
and here are my steps to configure CEDET ( I checked that it gives completions for std::list).
Basic setup
Get a fresh emacs and build it from source.
It's as easy as
./configure && make && sudo make install
Add to .emacs
(semantic-mode 1)
That's the whole setup.
Testing
Run emacs without loading anything:
emacs -q test.cc
Enter the code
#include <list>
int main() {
std::list lst;
lst.$
return 0;
}
M-x semantic-mode
with point at $, M-x semantic-ia-show-variants
Troubleshooting
If stuff doesn't work, it's likely that the semanticdb is corrupt.
Just find where it is, for me it's semanticdb-default-save-directory="~/.emacs.d/semanticdb",
and remove everything from there.
Then, when visiting a source file, call semantic-force-refresh.

Related

Eslint not working on emacs, complaining of "Checker definition probably flawed"

I am trying to set up eslint on emacs by writing this in .emacs:
(setq flycheck-disabled-checkers '(javascript-jshint))
(setq flycheck-checkers '(javascript-eslint))
(add-hook 'js-mode-hook
(lambda ()
(flycheck-mode t)
(tern-mode t)
))
What I am getting when trying to open js files then is this error message:
Just updated eslint to the latest version (1.3.1) and emacs to the latest version (24.5). Hoped that would help.
It didn't.
(I do have lots of old packages in ~/.emacs.d/elpa directory that are left from the time I installed them on the previous emacs version (24.3). But I don't think that's causing any issues).
Could you please suggest how to solve this problem with eslint?

error on invalid function: abbrev

I used to use Emacs in windows, recently I want to try Ubuntu 14.04. I used the same settings, same init.el, same packages. but I got an error when start Emacs under Ubuntu.
I am not an elisp programmer, and I hope I can get some help here. I am using Prelude for Emacs 24, but even I run emacs with -Q, the same error is still there....
The errors are as follows:
Debugger entered--Lisp error: (invalid-function "abbrev")
"abbrev"("convenience" "matching")
byte-code("\300\301\302\303\304\305\306\307\310\311\312\"&\207" [define-package "company" "20140731.944" "Modular text completion framework" ((emacs "24.1") (cl-lib "0.5")) :url "http://company-mode.github.io/" :keywords "abbrev" "convenience" "matching"] 11)
load("/home/zhijia/.emacs.d/elpa/company-20140731.944/company-pkg" nil t)
package-load-descriptor("/home/zhijia/.emacs.d/elpa" "company-20140731.944")
package-maybe-load-descriptor("company" "20140731.944" "/home/zhijia/.emacs.d/elpa")
package-load-all-descriptors()
package-initialize()
byte-code("\302\303!\210\302\304!\210\305\306\307\310#\210\311\312\"\313 \207" [prelude-dir package-user-dir require cl package add-to-list package-archives ("melpa" . "http://melpa.milkbox.net/packages/") t expand-file-name "elpa" package-initialize] 4)
require(prelude-packages)
eval-buffer(#<buffer *load*> nil "/home/zhijia/.emacs.d/init.el" nil t) ; Reading at buffer position 4156
load-with-code-conversion("/home/zhijia/.emacs.d/init.el" "/home/zhijia/.emacs.d/init.el" nil nil)
load("/home/zhijia/.emacs.d/init.el" nil nil t)
load-file("~/.emacs.d/init.el")
call-interactively(load-file record nil)
command-execute(load-file record)
execute-extended-command(nil "load-file")
call-interactively(execute-extended-command nil nil)
Delete ~/.emacs.d/elpa, restart Emacs, and let Prelude install all packages again.
It looks like you've stumbled across incompatibilities between package.el in different Emacs versions. I'm not sure why, though. Normally errors like this only occur when upgrading from Emacs 23 to 24, or when upgrading from Emacs 24.3 to the (not yet released) Emacs 24.4. Neither of these seem to be the case here, though.
You are getting this error with emacs -Q as well, because emacs -Q still loads all user-installed packages from ~/.emacs.d/elpa.
It seems you need to remove the ~/emacs.d/elpa/company-XXX and re-install it.
Even if you call it with -Q, it still has a startup file that checks the ~/.emacs.d/ directory.
Try first to remove the .elc files before to remove everything.

installing ya-snippet in emacs 23 manualy

I an new to emacs...so i was trying to install ya-snippets
for this first i downloaded the ya-snippet tar file and then uzipped it and then kept it .emacs.d/packages/
and then added the following code to my .emacs file
;; yasnippet
(add-to-list 'load-path
"~/.emacs.d/packages/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
but my obtaining the following error ...
Warning (initialization): An error occurred while loading `/home/nitesh/.emacs':
Symbol's function definition is void: yas-global-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
please tell me the error and as i am new to emacs and please tell what each line is doing my .emacs file written to configure yasnippet ?
and please tell me what to add to .emacs file for ya -snippet to use all c/c++ snippets that comes default with it?
Step One:  Place the following two lines near the top of your .emacs file and restart Emacs:
(require 'package)
(package-initialize)
Step Two:  M-x list-packages
Step Three:  Select Yasnippet with the left mouse click and then click Install, and click Yes.
Step Four:   Open up your .emacs file and place this underneath package-initialize
(require 'yasnippet)
(yas-global-mode 1)
Step Five:  Restart Emacs and have fun coding. The mode-line will display yas when that minor mode is active.

Ensime inferior scala mode

I've setup Emacs + Ensime for scala.
I'm able to start sbt console inside emacs using C-c C-v s
If i start scala console inside emacs using C-c C-v z, I get the following error
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_33).
scala>
Failed to initialize compiler: class scala.reflect.BeanInfo not found
What is the fix for this error? How do i get scala console running inside Emacs?
I've ran into a similar error recently, but here's how I worked around it (but I don't know how to fix it, so this is only half the answer). What I did was to customize the ensime-inf-default-cmd-line variable to have the value: '("sbt" "console"). Which will indeed start the interactive Scala environment.
EDIT:
Here's relevant parts from .emacs, but I'm not sure it will matter / will be the same in every install:
(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.
;;
;; more stuff ...
;; I'm not sure this line is correct / makes any difference
'(ensime-inf-cmd-template (quote ("sbt" "console" "-classpath" :classpath)))
;; This variable is used to launch the interpreter
'(ensime-inf-default-cmd-line (quote ("sbt" "console"))))
(require 'scala-mode2)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
I've installed scala-mode2 from MELPA. Installed sbt version 0.12.0 by downloading an RPM from their site. I had previously JRE and JDK installed, the active version is OpenJDK 1.7. Scala installed is 2.9.2. I don't know how to identify Ensime's version :|

EMMS: Error: "Don't know how to play track"

I work with Emacs 24.0.92 (9.0) on Mac OS X 10.7.3. I downloaded and installed
EMMS via git clone git://git.sv.gnu.org/emms.git and my ~/.emacs contains...
(add-to-list 'load-path "~/.emacs.d/emms/lisp")
(require 'emms-setup)
(emms-standard)
(emms-default-players)
... as suggested on http://www.gnu.org/software/emms/quickstart.html
If I use M-x emms-play-directory and choose a directory that contains .mp3
files, I obtain:
Don't know how to play track: (*track* (type . file) (name
. "/path/to/music/first song in this directory.mp3") (info-mtime 19612 57269)
(metadata))
I don't have mplayer installed, but VLC is installed and works perfectly
fine. What additional settings do I need in order for this to work?
Note that the player-list contains VLC (and others -- just the default). I also
set it to only VLC, but that gave the same error.
Also note that I found a similar error on
https://superuser.com/questions/179186/emms-emacs-multimedia-system-error-in-emacs-dont-know-how-to-play-track
but the "solution" there does not really explain what the problem is.
try following two steps that works on my Mac OS X 10.7.4
install mplayer on Mac
brew install mplayer
Add /usr/local/bin (where mplayer located) to emacs's exec-path by Adding following line to your ~/.emacs file
(setq exec-path (append exec-path '("/usr/local/bin")))
BTW, Following is all configuration related with emms in my .emacs file:
(setq exec-path (append exec-path '("/usr/local/bin")))
(add-to-list 'load-path "~/.emacs.d/site-lisp/emms/lisp")
(require 'emms-setup)
(require 'emms-player-mplayer)
(emms-standard)
(emms-default-players)
(define-emms-simple-player mplayer '(file url)
(regexp-opt '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://" "mms://"
".rm" ".rmvb" ".mp4" ".flac" ".vob" ".m4a" ".flv" ".ogv" ".pls"))
"mplayer" "-slave" "-quiet" "-really-quiet" "-fullscreen")
I have EMMS working fine with VLC on Mac OS X 10.9.1, this is my configuration related with EMMS:
(add-to-list 'load-path "~/.emacs.d/emms/lisp")
(require 'emms-setup)
(require 'emms-player-vlc)
(emms-standard)
(emms-default-players)
(setq emms-player-vlc-command-name
"/Applications/VLC.app/Contents/MacOS/VLC")
I had the same problem with Emacs 23.2 on Debian squeeze.
I managed to resolve it thanks to the links you gave, but I've no idea what was going on…
I added the following :
(setq emms-player-list '(emms-player-mpg321
emms-player-ogg123
emms-player-mplayer))
;debug players
(emms-player-for '(*track* (type . file)
(name . "myfile.pls")))
'eval-current-buffer' was not enough, I had to restart emacs. Then if I remove those lines, emms keeps working…
Emms was so difficult to make work for me. Mpg123 is maybe less featureful, but much easier : http://wikemacs.org/wiki/Media_player#Mpg123
It seems like emms has problems with spaces in the path name. Remove the spaces in the path name and it should work, if you don't have any other problems. Why would you want to run emms in os x anyways?
This fixes it for me:
(setq emms-player-mpg321-parameters '("-o" "alsa"))