Ensime inferior scala mode - scala

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 :|

Related

Package EXT does not exist

I am currently working through the Land of Lisp examples and have run into a compile exception: package EXT does not exist
from this line I suspect:
(ext:shell (concatenate 'string "dot -Tpng -O" fname))
I am running my repl inside emacs with slime and am unsure as to how to remedy this after some googling of the error.
Any help would be much appreciated.
It was in fact that SBCL was set as the default lisp program in emacs.
By replacing:
(setq inferior-lisp-program "/usr/bin/sbcl")
To:
(setq inferior-lisp-program "/usr/bin/clisp")
in my emacs configuration file fixed the issue. (On a Unix system at least)

Org-Babel Clojure Cider NRepl broken?

I followed the instructions here and wrote the following org-mode file:
#+BEGIN_SRC emacs-lisp
(princ (concat (format "Emacs version:\n%s\n" (emacs-version))
(format "\norg version: %s\n" (org-version))))
#+END_SRC
#+RESULTS:
: Emacs version:
: GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
: of 2016-09-17
:
: org version: 9.0.5
#+BEGIN_SRC clojure :results value
(* 6 7)
#+END_SRC
#+RESULTS:
* COMMENT org babel settings
Local variables:
org-confirm-babel-evaluate: nil
End:
As you can see, the evaluation of the emacs-lisp block works and produces the
expected output. Incidentally, it also reports the versions of things I'm using. However, the clojure source block, when evaluated, leaves
Code block returned no value.
I tried many different Clojure expressions in the code block, such as printlns and more. Nothing shows up in the NREPL window, and the results in org mode are always the same: the message above in the minibuffer.
in the emacs minibuffer. Here are the specific steps I took:
$ lein new clojure-example
$ cd clojure-example
$ emacs clojure.example.org
keyboarded in the file above
run emacs command cider-jack-in
That produces a repl window with the following version info:
;; Connected to nREPL server - nrepl://localhost:52695
;; CIDER 0.15.0snapshot (package: 20170403.402), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_121
etc.
put emacs cursor inside each block and type C-c C-c, which is bound to
org-babel-execute-src-block
Prior to that, I inserted the following code in my emacs initialization file:
(require 'org)
(require 'ob-clojure)
(org-babel-do-load-languages
'org-babel-load-languages
'( (clojure . t)
(emacs-lisp . t)
))
(setq org-babel-clojure-backend 'cider)
(require 'cider)
According to the cited instructions.
I'd be grateful for any help.
Yes, in the current stable release (9.0.5), the org-mode clojure backend is broken and does not work. I submitted a patch which has been applied and I expect will be in the next release.
See https://emacs.stackexchange.com/questions/30857/clojure-code-evaluation-in-org-mode-produces-no-output/31169#31169

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?

emacs24 semantic completion

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.

Installing YASnippet

I have installed YASnippet and configured it with this:
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas--initialize)
(yas/load-directory "~/.emacs.d/packages/yasnippet-0.6.1c/snippets")
However, when I launch Emacs it gives me an error:
Warning (initialization): An error occurred while loading `/home/alexander/.emacs':
Symbol's function definition is void: yas--initialize
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.
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
(require 'yasnippet) ;; not yasnippet-bundle
(yas--initialize)
(yas/load-directory "~/.emacs.d/packages/yasnippet-0.6.1c/snippets")
What am I doing wrong? I have tried to find the answer but with no success. (I have also tried with another version of yasnippet yasnippet-0.6.1b but it was the same.)
Just at a glance, that
(yas--initialise)
should be
(yas/initialize)
I'm running 0.6.1 and there's no such function as yas--initialize in the package.
My init code looks like
(require 'yasnippet)
(yas/initialize)
(yas/load-directory
(dot-emacs "elpa/yasnippet-0.6.1/snippets"))
I think you just got some garbled init code somewhere.
EDIT
I should have omitted the load-directory call in my sample since it's beside the point. But for what it's worth, dot-emacs is just a config-agnostic function I use to reference files relative to my init:
(defun dot-emacs (relative-path)
"Return the full path of a file in the user's emacs directory."
(expand-file-name (concat user-emacs-directory relative-path)))
FYI in case you ever upgrade: the information you got is correct for version 0.8, but for 0.7 and below yas/initialize is correct.
See this commit